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.

ResizeToFit and QueryCellStyleInfo Event

Thread ID:

Created:

Updated:

Platform:

Replies:

34210 Sep 6,2005 10:15 AM Sep 7,2005 04:20 AM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On September 6, 2005 10:15 AM

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 11:57 AM

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 03:11 AM

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 03:47 AM

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 04:20 AM

Thanks Clay now it works great !!

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.

;