Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.. friends, I am getting record from database and show the record in datagridview it is working very well after that I add another column at design time in Datagridview image type. and get another field with old record himage which has datatype image in database and set the Dataproperty value of the above mentioned column "himage" when i run my project then I see that the performance is very as compare before adding image column and another thing is that when I scroll Datagridview horizontally or vertically the images are starting to load again. Please tell me where I am wrong<, should I use any method to show the image in column if yes then which.

Thanks & regards
Parveen Rathi
Posted

1 solution

Can create image as thumbnail
1st option
-----------------------
Public Shared Function GetThumbNail(ByVal OrgImg As Image, ByVal ThumbWt As Int16, ByVal ThumbHt As Int16, Optional ByVal AbsSize As Boolean = False) As Image

Dim nPercent As Single = 0
Dim nHPercent As Single = 0
Dim nWPercent As Single = 0
Dim DestWt As Int32
Dim DestHt As Int32

DestWt = ThumbWt
DestHt = ThumbHt

If AbsSize = False Then
nWPercent = Convert.ToSingle(ThumbWt) / Convert.ToSingle(OrgImg.Width)
nHPercent = Convert.ToSingle(ThumbHt) / Convert.ToSingle(OrgImg.Height)

If nHPercent < nWPercent Then
nPercent = nHPercent
Else
nPercent = nWPercent
End If

DestWt = OrgImg.Width * nPercent
DestHt = OrgImg.Height * nPercent
End If

Dim tempCallBack As New Image.GetThumbnailImageAbort(AddressOf ThumbNailImageCallBack)

Return OrgImg.GetThumbnailImage(DestWt, DestHt, tempCallBack, IntPtr.Zero)

End Function
________________________________________________________________________
2nd Option is , Do not update directly data source, go for loop of kind of update the cell, when require....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900