I am using the dragbutton example and I would like to have the option to position the button to the left edge of the cell and resize the button to the size that I wanted.
Is this doable for the gird? If so, can some one point me to the right direction?
ADAdministrator Syncfusion Team June 15, 2004 01:46 PM
If you are using the "DragButton" celltype, you can set the cell''s style.TextAlign = GridTextAlign.Right to put these buttons on the left (text to the right instead of to the default left).
To set the size of the button, you need to change the ButtonBarSize = new Size(12*3, 12); in the DragButtonCellModel constructor. This sets 3 buttons to be 12x12.
ADAdministrator Syncfusion Team June 16, 2004 06:47 AM
I should make my question more precise.
I want the text to align to the left but with the button positioned to the left of the text.
The button needs to be all the way to the left edge of the cell (I am currently using only 1 button).
Can I also change the size of the button whenever I change the height of the row?
| | |
| | The Text |
| | |
This is the button.
ADAdministrator Syncfusion Team June 16, 2004 07:34 AM
The only property the grid has to position text and buttons is style.TextAlign. If that does not do what you need, then in your renderer''s OnDraw method, you would have to position and draw the text yourself. If you look at the OnDraw method in GridStaticCellRenderer, it does something similar, putting the text immediately to the left of an icon.
If you want your button height to grow with the row height, you can try just setting it to some max value. Most button classes in the grid will draw themselves at the minmum of the requested height or the cell height. By setting the requested height to a max value, you would just get the row height. Now I did not try this in the CellButtons sample, so I am not sure whether the drawing there is doing this type of thing.
If not, in the Renderer.OnInitialize method, you could try setting the model.ButtonBarSize there taking into account Grid.Model.RowHeights(RowIndex).
ADAdministrator Syncfusion Team June 16, 2004 10:23 AM