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.

Cell Button position

Thread ID:

Created:

Updated:

Platform:

Replies:

15277 Jun 15,2004 02:28 PM Jun 16,2004 11:23 AM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 15, 2004 02:28 PM

Hi, 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? thanks, Patrick

Administrator [Syncfusion]
Replied On June 15, 2004 02: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.

Administrator [Syncfusion]
Replied On June 16, 2004 07:47 AM

Clay, 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? ie. ---------------------- | | | | | The Text | | | | ---------------------- | | This is the button. Thanks, Patrick

Administrator [Syncfusion]
Replied On June 16, 2004 08: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).

Administrator [Syncfusion]
Replied On June 16, 2004 11:23 AM

Thank you. I got what I wanted.

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.

;