I am using the 2.0 beta and in a GridControl I am attempting to indent text and an image in one column. I do it like this:
gridCtl[nxt,1].BorderMargins.Left = 20 * iLevel;
This does exactly what I want when the cell has the focus, but when I click on another row, the text stays indented but the image moves to the left edge of the cell area, ignoring the margin.
I uploaded a small picture to help explain this.
You can see a collapse button (an image in the cell) on the left next to "Industry Segments". That one is right where it should be.
The one inside the focus rectangle is right where it should be also, but it wasn''t until I selected the cell. It was off to the left like the one below it ("Obtain and review...") which should be at the same indentation as the one in the focus rectangle.
There is another more subtle bug. The image is the same for all 3 rows. But the one inside the focus rectangle isn''t clear. It appears to have been rendered at a slightly different size.
ADAdministrator Syncfusion Team February 7, 2004 02:43 AM
The problem is that the static drawing draws to the cellbounds and the active drawing draws to the clientRectangle (which takes into account the margins).
You can work around this problem until there is a release available that changes this behavior. You can handle the CellDrawn event, and just draw the bitmap there. This gives you complete control over where you put the bitmap. Here is a little sample showing how you might to it.
Another option is to derive your own cell control that handles indents. There is a sample of this type of control in Syncfusion\Essential Suite\Grid\Samples\In Depth\VirtTreeGrid.
ABAndy BarnhartFebruary 7, 2004 03:55 AM
Thanks. The little sample you uploaded solves both problems in an acceptably small amount of code. I looked at the big sample earlier; there is a lot more code than I want to introduce and maintain to solve a simple issue. Other grids I have looked at have indent levels and do expand/collapse just by setting a couple of column properties and a cell level.