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

Buttons resize in cell

Thread ID:





69173 Oct 17,2007 02:30 PM UTC Oct 18,2007 12:09 AM UTC WinForms 1
Tags: GridControl
Thanvir Hussain
Asked On October 17, 2007 02:30 PM UTC

I have a custom cell model with two buttons in it. I want to resize the buttons so that they are of equal size and also resize to fill the cell. Whenever I resize the cell the buttons should grow equally.


haneefm [Syncfusion]
Replied On October 18, 2007 12:09 AM UTC

Hi Thanvir,

You need to override the OnLayout method of the renderer class to set the proper button bounds. In the method, the required position and size can be specified to draw the button in the required size inside the cell. Here is a little sample that puts two elipsis buttons in that covers a gridcell using that override.

protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
TraceUtil.TraceCurrentMethodInfo(rowIndex, colIndex, style, innerBounds, buttonsBounds);

this.Model.ButtonBarSize =new Size(innerBounds.Width,innerBounds.Height);
Rectangle rect = GridUtil.CenterInRect(innerBounds, this.Model.ButtonBarSize);
int width = rect.Width / 2;

buttonsBounds[0] = new Rectangle(rect.X, rect.Y, width, rect.Height);
buttonsBounds[1] = new Rectangle(rect.X + width , rect.Y, width, rect.Height);
return innerBounds;

Please refer the attached sample for implementation and let me know if this helps.

Best regards,


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

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