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

Cell Types and CellClicked event

What cell types support the CellClicked event? I'm trying to derive a cell type from the StaticCell type and am not able to determine which cell the mouse is clicked in. I've chosen the StaticCell type to derive from because I want to present a cell with different font sizes; this seems easiest to achieve with the StaticCell instead of the PushButton cell type. Can you provide me with some guidance, please?

2 Replies

CB Clay Burch Syncfusion Team August 6, 2002 06:11 PM UTC

In the release that should be out in the next few days, there are two click events in addition to the standard Control.Click event. They are GridControl.CellClick and GridControl.CellButtonClick. CellClick will be hit when you click in a cell and don't hit a cell button. The EventArgs include the row and col as well as the mouseeventargs of the click. The CellButtonClick occurs when you click a cell button. The eventargs include the row and col and buttonindex. You can handle these events at the form level, or you can catch then in your derived cell controls as the Grid member is known down in the renderer. You can catch a CellClick event in a static cell. Inyour renderer contructor, you can use code such as
this.Grid.CellButtonClicked += new GridCellButtonClickedEventHandler(ButtonClicked);
to hook a handler. In this case, we hook the CellButtonClick. -Clay


RM Roy Muller August 7, 2002 02:20 PM UTC

For the time being, I've discovered that I can use the MouseUp event with the aid of the Grid.PointToRowCol() method to function equivalently to a CellClick handler: private void OnMouseUp(object sender, MouseEventArgs e) { int row, col; MyGrid.PointToRowCol( new Point(e.X,e.Y), out l_row, out l_col); // do what I need with the grid cell MyObject = MyGrid[row,col].Tag; ... } I wasn't clear about this in my original post, but I was not interested in getting this event in my derived cell renderer class; I want to get this event handled in the System.Windows.Forms.UserControl class which contains my grid control. Thanks for your insights and suggestions. I'll look for the CellClick event support for StaticCell derived cell types in the forthcoming release. -Roy

Loader.
Live Chat Icon For mobile
Up arrow icon