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.

Performance Problem(Resize To Fit)

Thread ID:

Created:

Updated:

Platform:

Replies:

35322 Sep 28,2005 05:31 AM Jan 26,2012 12:58 AM Windows Forms 9
loading
Tags: GridControl
manohar
Asked On September 28, 2005 05:31 AM

Hi There, Actually I am using Griddataboundgrid, and it contains 160 records,and that gird contains one column(cells) which is of type Richtext.So obviously each and every row height will be different(ofcourse not always).To load that form it is taking 16 seconds.If I just comment "this.Model.RowHeights.ResizeToFit" this method the form will load in 2 seconds.Kindly provide some solution for this.I am pasting that line of code below in quotations. I checked using Beginupdate,suspendbinding all that stuff,so kindly give some other solution. "this.Model.RowHeights.ResizeToFit(GridRangeInfo.Cells(1, 1,this.Model.RowCount,1),GridResizeToFitOptions.ResizeCoveredCells);" Regards, Manohar.

Administrator [Syncfusion]
Replied On September 28, 2005 08:27 AM

Manohar, try to limit the number of rows to scan: int maxRowsToScan = 100; this.Model.RowHeights.ResizeToFit(GridRangeInfo.Cells(1, 1,Math.Min(maxRowsToScan, this.Model.RowCount),1),GridResizeToFitOptions.ResizeCoveredCells); Stefan >Hi There, > > Actually I am using Griddataboundgrid, and it contains 160 records,and that gird contains one column(cells) which is of type Richtext.So obviously each and every row height will be different(ofcourse not always).To load that form it is taking 16 seconds.If I just comment "this.Model.RowHeights.ResizeToFit" this method the form will load in 2 seconds.Kindly provide some solution for this.I am pasting that line of code below in quotations. >I checked using Beginupdate,suspendbinding all that stuff,so kindly give some other solution. > > >"this.Model.RowHeights.ResizeToFit(GridRangeInfo.Cells(1, 1,this.Model.RowCount,1),GridResizeToFitOptions.ResizeCoveredCells);" > > > > >Regards, >Manohar. >

manohar
Replied On September 28, 2005 10:05 AM

Hi Stefan, see if we scan less rows than grid row count,rows which are not scanned are not resized what I mean is, row is getting set with the default height than expected(means if four lines are there it is showing only one line which fits in the default height,and rest is mystery).If that''s the case if I just comment the line which i gave you earlier, it takes only 2 seconds to load the grid(Having 160 records,means i am not resizing any row).So the total problem lies in resizing and I need to do resize of that cells.Kindly provide some other solution for this problem. Regards, Manohar.

Administrator [Syncfusion]
Replied On September 28, 2005 08:08 PM

Manohar, I misunderstood first. Sorry about that. The following code lets you size the rows on demand just before they are drawn: public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); //Listen to the IBindingList.ListChanged events instead of the //CurrencyManager events. this.gridDataBoundGrid1.UseListChangedEvent = true; this.gridDataBoundGrid1.Model.QueryRowHeight += new GridRowColSizeEventHandler(Model_QueryRowHeight); this.gridDataBoundGrid1.Model.QueryRowHeightTotal += new GridRowColSizeTotalEventHandler(Model_QueryRowHeightTotal); inModel_QueryRowHeight = true; } protected override void OnLoad(EventArgs e) { base.OnLoad (e); this.gridDataBoundGrid1.Model.RowHeights.ResizeToFit(this.gridDataBoundGrid1.ViewLayout.VisibleCellsRange, GridResizeToFitOptions.IncludeCellsWithinCoveredRange); inModel_QueryRowHeight = false; } bool inModel_QueryRowHeight = false; void Model_QueryRowHeightTotal(object sender, GridRowColSizeTotalEventArgs e) { GridModel gridModel = (GridModel)sender; ResizeRows(gridModel, e.From, e.Last); } void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e) { GridModel gridModel = (GridModel)sender; ResizeRows(gridModel, e.Index, e.Index); } void ResizeRows(GridModel gridModel, int from, int to) { if (inModel_QueryRowHeight) return; inModel_QueryRowHeight = true; try { gridModel.RowHeights.ResizeToFit(GridRangeInfo.Rows(from, to), GridResizeToFitOptions.IncludeCellsWithinCoveredRange); } finally { inModel_QueryRowHeight = false; } } This is the example: ResizeRowsOnDemand.zip Stefan

manohar
Replied On September 29, 2005 09:11 AM

Hi Stefan, First let me thank in the progress.But I have couple of questions still. 1.)If I want to do ondemand,when will this "Model_QueryRowHeightTotal" or the other event(s) will get fired.What i mean is what is the operation I need to perform to fire this event. 2.)Second is,I would like to resize all the rows before I load the form(not on demand),in that case is there any other solution which i can opt for and reduce the load time(16 seconds). To make this requirement more clear I am providing you an attachment with some images. First image contains only one row.when i double click that row it will open the second image/form which contains 160 records with huge rich text in the second column(to open this it is taking 16 seconds). Thanks in advance, Regards, Manohar B. RichTextRows_4440.zip

Administrator [Syncfusion]
Replied On September 29, 2005 11:58 AM

Hi, 1) the grid will fire the event before the rows are drawn. The event will be fired just before the row comes into view when the user is scrolling through the grid. 2) I don''t know of any way to make the RichText cell resize faster. It is a very slow operation to resize a rich text box since you probably need to initialize a RichTextBox cell by cell and let it resize itsself using some tricks. I am actually not aware that the grid has code for resizing RichText cells... The GridRichTextBoxCellModel does not implement CalculatePreferredCellSize. Did you provide your own implementaion here? Stefan >Hi Stefan, > > First let me thank in the progress.But I have couple of questions still. > >1.)If I want to do ondemand,when will this "Model_QueryRowHeightTotal" or the other event(s) will get fired.What i mean is what is the operation I need to perform to fire this event. >2.)Second is,I would like to resize all the rows before I load the form(not on demand),in that case is there any other solution which i can opt for and reduce the load time(16 seconds). > >To make this requirement more clear I am providing you an attachment with some images. >First image contains only one row.when i double click that row it will open the second image/form which contains 160 records with huge rich text in the second column(to open this it is taking 16 seconds). > >Thanks in advance, > >Regards, >Manohar B. > >RichTextRows_4440.zip > >

manohar
Replied On September 30, 2005 03:33 AM

Hi Stefan, The attahcment(ResizeRowsOnDemand_ca7c2aff.zip) you have sent has got one bug, its not getting excuted.I am providing the error message,pls rectify it and send me back as early as possible. Regards, Manohar B. Error_5133.zip

Administrator [Syncfusion]
Replied On October 2, 2005 08:46 PM

Hi, The data file was missing and I did not check in the sample if record count equals 0. Please copy the following files to the directory and also change the following line in the sample: ReadXml(@"GDBDdata.XML"); // used to be Data/GDBDdata GDBDdata.zip Stefan

Hijacker
Replied On January 20, 2012 03:00 PM

Syncfusion developers / staff,

I would like to congratulate you about the broken attachment links.
That's GREAT for us who seek a little help when dealing with problems on your amazingly slow WinForm grid control.

Your forum is also a great for code display and understanding. As we can see it's almost impossible to understand what's going on between the conversations.

CONGRATULATIONS!!!!


Ragamathulla B [Syncfusion]
Replied On January 26, 2012 12:58 AM

Hi H1J4CK3R,

We regret for the inconvenience.

We have moved to the previous sample from the server due to server maintaince. I would like to suggest you please refer to the following samples for improve the performance which is holding in our sample broswer.

{Installed path}\Syncfusion\EssentialStudio\{Version}\Windows\Grid.Windows\Samples\2.0\Performance

Hope this helpful for your reference

http://help.syncfusion.com/ug_94/User%20Interface/Windows%20Forms/Grid/Documents/4341performance.htm

Let me know if you have any further concerns.

Regards,
Ragamathullah B.


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.

;