We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Virtualized PictureBox cells

Thread ID:





70820 Jan 3,2008 06:58 AM UTC Jan 10,2008 04:02 PM UTC WinForms 2
Tags: GridControl
Sudharsini Ravikumar
Asked On January 3, 2008 06:58 AM UTC


I load a huge amount of data into the grid (single column grid) where most of the rows contain images. The way I load image is

Dim sp As PictureBoxStyleProperties = New PictureBoxStyleProperties(e.Style)
sp.SizeMode = PictureBoxSizeMode.Zoom
sp.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Center
sp.StyleInfo.VerticalAlignment = GridVerticalAlignment.Middle

Dim fs As New System.IO.FileStream(imgPath, IO.FileMode.Open, FileAccess.Read)
Dim bm As New Bitmap(fs)
fs = Nothing

sp.Image = bm

With this I get the Out of memory exception. So I wanted to make the image cells alone virtual. I expected thr QueryCellInfo event to be fired for a cell only when the cell is visible. But this is fired for all rows. I don't understand how to implement this.

Also when I load the grid initially I set a place holder image from the resource. Then when the grid is scrolled and a new image row becomes visible want to set the actual image to be displayed.

How can I do this?

Thanks a lot for your help. Its much appreciated.


Jeba S [Syncfusion]
Replied On January 10, 2008 01:41 PM UTC

Hi Sudha,

Currently we are working for this .We will update you within one business day.

Thank you for being patient.

Best regards,

haneefm [Syncfusion]
Replied On January 10, 2008 04:02 PM UTC

Hi Sudha,

You can use the PrepareViewStyleInfo/QueryCellInfo event to shows the image in a gridcell on demand. PrepareviewStyleInfo event does not store any styleInfo properties in a grid. It just set the visual apperence of the grid. Here is a code snippet that shows this task.

Private Sub gridControl1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As PrepareViewStyleInfoEventArgs)
If e.ColIndex = 5 Then
Dim grid As GridControl = sender as GridControl
Dim cellRange As GridRangeInfo = GridRangeInfo.Cell(e.RowIndex,e.ColIndex)
If grid.ViewLay.VisibleCellsRange.IntersectsWith(cellRange) Then
'Visible Cell code here...
'e.Style.CellType = "PicturBoxCellType";
'Non Visible Cells.
End If
End If
End Sub

Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon