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.

GDBG Cell formatting

Thread ID:

Created:

Updated:

Platform:

Replies:

33878 Aug 29,2005 03:58 AM Aug 30,2005 03:42 AM Windows Forms 6
loading
Tags: GridControl
Atith Pagdi
Asked On August 29, 2005 03:58 AM

Hi, I need to do the following: - Set autosize = on for all cells in the GDBG. - Decrease the height of certain rows/cells in the GDBG. - Insert line separators after every 6 rows in the GDBG If anyone knows how any of these can be done, please let me know. Thanks

Administrator [Syncfusion]
Replied On August 29, 2005 04:12 AM

- Set autosize = on for all cells in the GDBG. grid.TableStyle.AutoSize = true; - Decrease the height of certain rows/cells in the GDBG. Subscribe to the grid.Model.QueryRowHeight event. In your handler, if e.Index points to a row wher eyou want to set a size, then set e.Size to be the size you want, and also set e.Handled = true; - Insert line separators after every 6 rows in the GDBG I do not know of an easy way to do this. You can add a special cell border using PrepareViewStyleInfo. Here is a sample showing the last 2 points. http://www.syncfusion.com/Support/user/uploads/GDBG_Delete_11d18467.zip

Atith Pagdi
Replied On August 29, 2005 07:40 AM

What''s the subroutine signature for this.dgTest.Model.QueryRowHeight +=new GridRowColSizeEventHandler(Model_QueryRowHeight) Is it private void Model_QueryRowHeight(object sender, GridQueryCellInfoEventArgs e) If it is, I get e.Style attribute. How do I set the height attribute for e? Thanks

Administrator [Syncfusion]
Replied On August 29, 2005 07:44 AM

Here is the code from the sample I gave you.
private void Model_QueryRowHeight(object sender, Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs e)
{
	if((e.Index % 3) == 1)
	{
		e.Size = 40;
		e.Handled = true;
	}
}
The sample runs fine for me. Did it not run for you? There is no e.Style in the Grid.GridRowColSizeEventArgs e argument.

Atith Pagdi
Replied On August 29, 2005 10:16 AM

Hey it works! Thanks... What about having a line separator? how would I do it in PrepareViewStyleInfo? Do you have a sample? Also, I set the TableStyle.AutoSize property to true in the design view, but when the text is too long in a cell, it just gets cut off and the cell doesn''t expand vertically. Any idea why this is happening? Do I need to explicitly set it in the code behind?

Administrator [Syncfusion]
Replied On August 29, 2005 10:29 AM

Did you look at the sample? It had border styles set in PrepareViewStyleInfo. Autosize only works as your user types. If you set text into a cell programmatically, then autosize will not affect this. Instead, you will have to explicitly call grid.Model.ColWidths.ResizeToFit to make the columns become wider so the text will fit. If you are doing this in Form.Load before the grid is visible, then you also need to set grid.AllowResizeToFit = false;

Atith Pagdi
Replied On August 30, 2005 03:42 AM

Thanks! That solves all my problems.

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.

;