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.
Unfortunately, activation email could not send to your email. Please try again.

Buttons resize in cell

Thread ID:

Created:

Updated:

Platform:

Replies:

69173 Oct 17,2007 10:30 AM Oct 17,2007 08:09 PM Windows Forms 1
loading
Tags: GridControl
Thanvir Hussain
Asked On October 17, 2007 10:30 AM

Hi,
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.

thanks
thanvir

haneefm [Syncfusion]
Replied On October 17, 2007 08:09 PM

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.
ResizeTowButton.zip

Best regards,
Haneef

CONFIRMATION

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.

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.

;