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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Context menu location change

Thread ID:





37923 Dec 2,2005 05:58 AM UTC Dec 8,2005 12:40 PM UTC WinForms 6
Tags: GridControl
Administrator [Syncfusion]
Asked On December 2, 2005 05:58 AM UTC

Hi, I am using Essential Suite I am having a context menu associated with the Syncfusion.Windows.Forms.Grid.GridControl. The GridControl has multiple rows and columns, I can select a cell by left click on mouse, and if I right click there then able to see the context menu on selected cell (current cell). However, if I right click somewhere outside the cell (but with in the Grid Control) then the context menu displayed on location of mouse cursor. How can I show the context menu on selected cell (current cell) instead of on cursor position? Is there any way to change the location of the context menu in either ContextMenu_PopUp event or other method? Thanks in advance Dhans

Administrator [Syncfusion]
Replied On December 2, 2005 01:06 PM UTC

Here is a little sample that positions a context menu (and the mouse cursor) in the middle of the current cell if you right click outside it. It also sets the contextmenu in the middle of a selected range of cells if you right click out side of the selection. Maybe something like this will work for you. http://www.syncfusion.com/Support/user/uploads/GC_ContextMenu_60da496f.zip

Administrator [Syncfusion]
Replied On December 8, 2005 09:04 AM UTC

Clay, Thanks for that reply. Now, my requirement is, change the current cell to mouse cursor position when i right click inside the grid.

stanleyj [Syncfusion]
Replied On December 8, 2005 10:11 AM UTC

Hi Dhans, You can move the current cell by getting the respective row, column of the cursor position by calling the PointToRowCol function. Here is the modified sample and the necessary codes are below. this.gridControl1.PointToRowCol(pt, out row, out col); this.gridControl1.CurrentCell.MoveTo(row, col); Regards, Stanley

Administrator [Syncfusion]
Replied On December 8, 2005 10:30 AM UTC

Thanks Stanley, Already I have selected multiple cells, Then If I try to move the CurrentCell then the selections cleared. How to I retain the Selections of the GridControl?

stanleyj [Syncfusion]
Replied On December 8, 2005 11:53 AM UTC

Hi Dhans, How are the selections getting cleared? The selections are not cleared when moving with arrow keys or with right mouse click. Regards, Stanley

Administrator [Syncfusion]
Replied On December 8, 2005 12:40 PM UTC

Thanks Stanley, Now its works fine for me.


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