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.
Syncfusion Feedback

ColumnStyle performance vs OnPrepareViewStyleInfo

Thread ID:

Created:

Updated:

Platform:

Replies:

5681 Jul 14,2003 10:41 AM UTC Jul 14,2003 11:37 AM UTC Windows Forms 1
loading
Tags: GridControl
Olivier Choquette
Asked On July 14, 2003 10:41 AM UTC

I'm using the GridControl class as a base for a virtual grid which displays a relatively small number of columns (and a potientially large number of rows). I currently customise the properties in the GridStyleInfo depending which type of data the column has to display (maximum numeric values, maximum caracters, readonly and such) in the OnPrepareViewStyleInfo method (which I think is called before the QueryCellInfo of each cell) All of my custom properties are stores in "simple" (O(1)) variables . Would there be a noticable performance increace if i where to store these values in the column style instead ? (its working fine as it is so i wouldn't want to change the design unless there were a performance increace or someone pointed out that i was shooting myself in the foot ;) Olivier

Administrator [Syncfusion]
Replied On July 14, 2003 11:37 AM UTC

Hi Olivier, if access to your functions is O(1) I wouldn't worry. Only if you have code that takes more operations I would then choose a different solution. PrepareViewStyleInfo is called each time a grid view needs information about a cell, e.g. when drawing or hit-testing. The information you provide with PrepareViewStyleInfo is not cached and thus gives you the best chance to return real-time results based on a grid views context and you can also take view-specific context such as current cell position into account. The other event that lets you provide cell information is QueryCellInfo. This event is called from the GridModel itsself and provides cell-information independent of view context. This information is cached and only renewed when garbage collector collects the memory or when you call ResetVolatileData. Another note: PrepareViewStyleInfo is called whenever you call GetViewStyleInfo. GetViewStyleInfo will always create a style object based on the grid models indexer and then call PrepareViewStyleInfo. After the style has been used style.Dispose will release the memory for this object immeditaly. However, PrepareViewStyleInfo will not be called if you query for cell information by using the indexer. e.g. grid.Model[2, 2]. The indexer only calls QueryCellInfo if the cell information is not cached at the time of the call. Hope this gives some insight. Stefan

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.

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

;