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


Thread ID:





8477 Nov 7,2003 06:46 AM UTC Nov 7,2003 08:06 AM UTC WinForms 1
Tags: GridControl
Kai Wachter
Asked On November 7, 2003 06:46 AM UTC

Hi all, I try to enhance the CellDragButton example. I want to insert different numbers of buttons in some cells. I tried to override the Draw method in the renderer but the buttons are always added. i want to clear the button collection, but i find no possibilty. What do i make wrong. Thanks for your help. Best regards Kai.

Administrator [Syncfusion]
Replied On November 7, 2003 08:06 AM UTC

In the CellButton sample, the number of buttons is used both in the CellModel class where it sets the BarSize and the CellRenderer class in the constructor where its creates and adds the buttons. And any buttons that have been added using renderer.AddButtons will be drawn when the base class ondraw is called. So, if you do not want to see them, you have to remove them using renderer.RemoveButton before you call the base class draw. But the problem is dynamically changing these particular cellmodel/cellrenderer properties as the grid needs each cell (say to draw) will be involved. I think the simplest way to do this would be to create new CellModel/CellRenderer objects to handle differing numbers of buttons. You can change the sample code to pass the number of buttons in the model constructor and renderer constructor, and use that value to crate a varying number of buttons. Then use grid.CellModels.Add to add a different celltype for each number of button cells you need. gridControl1.CellModels.Add("Ellip1", new MyEllipsisCellModel(gridControl1.Model, 1)); gridControl1.CellModels.Add("Ellip2", new MyEllipsisCellModel(gridControl1.Model, 2)); gridControl1.CellModels.Add("Ellip4", new MyEllipsisCellModel(gridControl1.Model, 4)); Then you would set the CellType of any of your button cells to which of the "EllipX" is needed for the particular cell. And this could be done dynamcially if needed.


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

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

Live Chat Icon For mobile
Live Chat Icon