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

Cell Types and CellClicked event

Thread ID:





729 Aug 6,2002 05:10 PM UTC Aug 7,2002 02:20 PM UTC WinForms 2
Tags: GridControl
Roy Muller
Asked On August 6, 2002 05:10 PM UTC

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?

Clay Burch [Syncfusion]
Replied On 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

Roy Muller
Replied On 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


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