Hi Kyle,
This can be acheived by deriving the GridComboBoxCellModel class and overriding OnQueryPrefferedClientSize Method to change the default resizing behavior of the combo box cell in a grid. Here is a code snippet to show this.
public class MyComboBoxCellModel : GridComboBoxCellModel
{
public MyComboBoxCellModel(GridModel grid): base(grid){}
protected override Size OnQueryPrefferedClientSize(Graphics g, int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
{
Size size = g.MeasureString(style.FormattedText,style.GdipFont).ToSize();
return size + this.ButtonBarSize;
}
public override GridCellRendererBase CreateRenderer(GridControlBase control)
{
return new MyComboBoxCellRenderer(control, this);
}
}
Here is a sample.
ResizeToFitComboBox.zipBest Regards,
Haneef