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. Image for the cookie policy date

GridControl ButtonBarSize

I have attempted to change the default button size on the grid by doing something like: grid.TableStyle.CellModel.ButtonBarSize = new Size(24,12); However, the grid seems to ignore this. How do I change the button size to prevent the button from filling the entire cell? I would rather not implement a custom cell for a simple button size specification. Thanks.

4 Replies

AD Administrator Syncfusion Team November 23, 2004 12:18 AM

You have to do this on a CellType basis. SO, to size all comboboxes, use code like: GridCellModelBase model = this.gridControl1.CellModels["ComboBox"]; model.ButtonBarSize = new Size(12, 6);


AD Administrator Syncfusion Team November 23, 2004 11:46 AM

That didn''t seem to work, here is some of the code: grid[1,7].CellType = "PushButton"; grid[1,7].Description = "Click"; grid[1,7].TextColor = Color.Black; grid.CellModels["PushButton"].ButtonBarSize = new Size(10,6); I have tried moving the last line before the other three and it still does not work. Want I want is a button type cell that has a very small button even when the cell itself is very wide. >You have to do this on a CellType basis. SO, to size all comboboxes, use code like: > >GridCellModelBase model = this.gridControl1.CellModels["ComboBox"]; >model.ButtonBarSize = new Size(12, 6); >


AD Administrator Syncfusion Team November 23, 2004 12:06 PM

The PushButton celltype is special. It is designed to be sized to the cell since it is intended to occupy the entire clientarea of the cell. If you do not want the pushbutton to occupy the whole cell, you can set style.BorderMargins.Left, style.BorderMargins.Right, (Top and Bottom) properties to tell the button not to use that part of the cell. The code I gave does work with a ComboBox button.


AD Administrator Syncfusion Team November 23, 2004 03:03 PM

Cool.. the border adjustment worked. Thank you!

Loader.
Live Chat Icon For mobile
Up arrow icon