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.
Unfortunately, activation email could not send to your email. Please try again.

Virtualized PictureBox cells

Thread ID:

Created:

Updated:

Platform:

Replies:

70820 Jan 3,2008 01:58 AM Jan 10,2008 11:02 AM Windows Forms 2
loading
Tags: GridControl
Sudharsini Ravikumar
Asked On January 3, 2008 01:58 AM

Hi

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.Close()
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.

Sudha


Jeba S [Syncfusion]
Replied On January 10, 2008 08:41 AM

Hi Sudha,

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

Thank you for being patient.

Best regards,
Jeba.


haneefm [Syncfusion]
Replied On January 10, 2008 11:02 AM

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";
Else
'Non Visible Cells.
End If
End If
End Sub


Best regards,
Haneef


CONFIRMATION

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.

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.

;