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

How can I get margin values in a GridDataBoundGrid?

Thread ID:





32716 Aug 5,2005 07:34 PM UTC Aug 5,2005 10:43 PM UTC WinForms 1
Tags: GridControl
Bob Berger
Asked On August 5, 2005 07:34 PM UTC

I am using a GridDataBoundGrid. I am handling the PrepareViewStyleInfo event to add row headers to my data bound grid. I am using the ColWidths property to set the width of the column containing the row headers, which of course is column zero. How can I programmatically determine the width of the margins that Syncfusion uses for either row headers or column headers that it creates? I''d like to use this value in my algorithm for setting the width of my row headers. I can''t get this information from my grid''s Model.RowStyles indexer, because data bound grids don''t have RowStyles. I''ve tried getting the margin information from several other places, such as GridPrepareViewStyleInfoEventArgs.Style.TextMargins, and my grid''s CellRenderers["TextBox"].StyleInfo.TextMargins, but in both cases the GridMarginsInfo Left and Right properties contain the value 1. When Syncfusion puts headers in a grid, it looks to me like there is more than 1 pixel separating the text from the cell borders, so I have two questions. 1) How can I get the margin values that are normally used in the column and/or row headers of Syncfusion grids? 2) Does Syncfusion use some other value to place some empty space between header labels and their cell borders? I''m using Syncfusion version and MS Visual Studio .NET 2003 with the 1.1 Framework on Windows XP SP2.

Administrator [Syncfusion]
Replied On August 5, 2005 10:43 PM UTC

The styles of the row headers come from grid.BaseStylesMap["Row Header"].StyleInfo. Other padding of the cells contents can be also attributed to style.TextMargins values. But the raised look of a Header cell is actually explicitly drawn by the header cellrenderer.OnDraw code. So, the BorderMargins likely will not affect this. If you want to have the full use of the margins in header cells, you should try changing style.CellType to something like "Static" which will make the header cell not use the header cellRenderer which explicitly draws the raised edges on the normal header cell. After doing this, you can also set Borders, Appearances and other style setting on the grid.BaseStylesMap["Row Header"].StyleInfo and have them take effect. If you do not change teh CellType, then the header renderer will ignore these setting and do what it does to draw teh standard raised header cell.


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

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