Dear All Master,
I want to resize the dimensions of the image so that it helps the performance of the image that appears in the columnuboudcolumn image in the gridview. Is there any solution?
because if I use directly from the size of the image file it makes it slow in the gridview.
for image file information there are 5000 files with each file having dimensions of 1748x2480
thanks
roy88
Code:Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load DataGridView() Dim repItemGraphicsEdit As New RepositoryItemPictureEdit() repItemGraphicsEdit.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Squeeze GridControl1.RepositoryItems.Add(repItemGraphicsEdit) GridView1.Columns("IMAGE1").ColumnEdit = repItemGraphicsEdit GridView1.Columns("IMAGE2").ColumnEdit = repItemGraphicsEdit GridView1.Columns("IMAGE3").ColumnEdit = repItemGraphicsEdit End Sub Private Sub gridView1_CustomUnboundColumnData(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs) Handles GridView1.CustomUnboundColumnData Dim view As GridView = TryCast(sender, GridView) Dim filename1 As String If Not DBNull.Value.Equals(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "FILENAME1")) Then filename1 = CStr(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "FILENAME1")) Else filename1 = String.Empty 'or Nothing depending what comes next. End If Dim filename2 As String If Not DBNull.Value.Equals(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "FILENAME2")) Then filename2 = CStr(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "FILENAME2")) Else filename2 = String.Empty 'or Nothing depending what comes next. End If Dim filename3 As String If Not DBNull.Value.Equals(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "FILENAME3")) Then filename3 = CStr(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "FILENAME3")) Else filename3 = String.Empty 'or Nothing depending what comes next. End If Dim SUBFOLDERP As String If Not DBNull.Value.Equals(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "SUBFOLDERP")) Then SUBFOLDERP = CStr(view.GetListSourceRowCellValue(e.ListSourceRowIndex, "SUBFOLDERP")) Else SUBFOLDERP = String.Empty 'or Nothing depending what comes next. End If Dim img As Image = Nothing Try If e.Column.Caption = "IMAGE1" Then Dim filePath1 As String = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & SUBFOLDERP, filename1, False) e.Value = GetImage(filePath1) ElseIf e.Column.Caption = "IMAGE2" Then Dim filePath2 As String = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & SUBFOLDERP, filename2, False) e.Value = GetImage(filePath2) ElseIf e.Column.Caption = "IMAGE3" Then Dim filePath3 As String = DevExpress.Utils.FilesHelper.FindingFileName(parentpathimage & SUBFOLDERP, filename3, False) e.Value = GetImage(filePath3) Catch End Try End Sub Function GetImage(str As String) As Image If (Images.ContainsKey(str)) Then Return CType(Images(str), Image) Else Dim img = Image.FromFile(str) Images.Add(str, img) Return img End If End Function




Reply With Quote
