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

ResizeToFit and QueryCellStyleInfo Event

Thread ID:





34210 Sep 6,2005 02:15 PM UTC Sep 7,2005 08:20 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On September 6, 2005 02:15 PM UTC

I use the QueryCellStyleInfo event in my gridgroupingcontrol to show an icon in a column (which depends on another column). Everything seems fine, but the resizetofit function doesn''t seem to work anymore. Cell content is cut (or hidden) by neighbor cells and so on. When I remove the QueryCellStyleInfo event the ResizeToFit works as expected. Isn''t it possible to use both things together (QueryCellStyleInfo and ResizeToFit)? Cheers, Markus

Administrator [Syncfusion]
Replied On September 6, 2005 03:57 PM UTC

Something to try. In QueryCellStyleInfo, try also setting e.Style.TextMagin.Left to reserve the space used by the icon when it is present. This may allow ResizeToFit to work properly.

Administrator [Syncfusion]
Replied On September 7, 2005 07:11 AM UTC

Hmm Clay, I played around with your suggested property - but it doesn''t really do what I want. I have attached an example where you can see that the resize doesn''t really work as expected. GGC_4tables_Resize_8690.zip Perhaps you know what''s wrong? Cheers, Markus

Administrator [Syncfusion]
Replied On September 7, 2005 07:47 AM UTC

A couple of things not as needed here. One is that you subscribe to the QueryCellStyleInfo event after you have called ResizeToFit so there would be no way for the grid to know that it needed to adjust for a bitmap in the resizetofit call. But even subscribing to the event before calling resizetofit is not sufficient as the GridRangeInfo.Table will only catch the visible rows. So, as long as the node is collapsed, it will not really use teh QueryCellStyleInfo event which is what is needed to know about teh image. One solution is to call resizetofit as you expand a node. You could always do it, or you could keep track of what tables have already been sized, and only do it on the first expansion.
void gridGroupingControl1_GroupExpanded(object sender, GroupEventArgs e)
	GridTableModel model = gridGroupingControl1.GetTableModel(e.Group.Records[0].ParentTableDescriptor.Name);
	model.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders | GridResizeToFitOptions.IncludeCellsWithinCoveredRange);

Administrator [Syncfusion]
Replied On September 7, 2005 08:20 AM UTC

Thanks Clay now it works great !!


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

or the page will be automatically redirected to 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