Month Calendar Context Menu Problem

i do a own context menu for month calendar. when it pop up , it will no focus on the point. How to move the selected date to the point? I try use coding below to get the row index and col index of the gridcontrol in monthcalendar. but it is no the date i click. ((GridControl)(control)).PointToRowCol(ClickPoint, out rowIndex, out colIndex); string dateSelect = ((GridControl)(control))[colIndex, rowIndex].CellValue.ToString(); free to ask me if cant get the idea. thanks in advance!

mthClendar.zip

2 Replies

AD Administrator Syncfusion Team June 23, 2006 06:23 PM UTC

Hi Ks, You need to set the location of the context menu in a CellMouseDown event of the grid control. Please find the code snippet here. //Here context menu show in cell (2,2) bool IsContextMenu = false; private void grid_CellMouseDown(object sender, GridCellMouseEventArgs e) { if(e.MouseEventArgs.Button == MouseButtons.Right) { GridControl grid = sender as GridControl; GridCurrentCell cc = grid.CurrentCell; Point pt = grid.GetCellRenderer(2,2).GetCellBoundsCore(2,2).Location; //Point pt1 = cc.Renderer.GetCellBoundsCore(cc.RowIndex,cc.ColIndex).Location; grid.ContextMenu = this.menu; this.menu.Show(grid, pt); IsContextMenu = true; e.Cancel = true; } else IsContextMenu = false; } private void mgrid_CellMouseUp(object sender, GridCellMouseEventArgs e) { if(e.MouseEventArgs.Button == MouseButtons.Right) e.Cancel = true; } Here is a sample. http://www.syncfusion.com/Support/user/uploads/DateTime value_fcaf7296.zip Let me know if this helps. Best Regards, Haneef


KK ks kee June 26, 2006 03:09 AM UTC

Hi Haneef, i still fail to get the rowindex and colindex on the point i click, because the current cell still the previous one. then i put some coding in cellmousedown(success use this coding for databoundgrid before), it works :) int rowIndex, colIndex; Point ClickPoint = new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y); grid.PointToRowCol(ClickPoint, out rowIndex, out colIndex); thanks for your help!!!

Loader.
Up arrow icon