PC Review


Reply
Thread Tools Rate Thread

ContectMenu, Datagrid & HitTestInfo

 
 
MDB
Guest
Posts: n/a
 
      29th Dec 2004
Hello All, I use the below code to get the cell a user clicked in order for
the context menu to pop up and for some reason, I can click on or around the
exact same area and always get different results. Is there something that I
am missing or something I am doing wrong to get the correct cell
(row,column)? One thing I have noticed is that the first time the
contextmenu is displayed that point is always -8,-58 no mater where I click.



private void contextMenu1_Popup(object sender, EventArgs e)

{
Point pt = dgStdAreas.PointToClient( Control.MousePosition );

int x = pt.X;
int y = pt.Y;


DataGrid.HitTestInfo hti = dgStdAreas.HitTest(pt.X,pt.Y);

}




 
Reply With Quote
 
 
 
 
darek@m-core.pl
Guest
Posts: n/a
 
      30th Dec 2004
It was reported many times on this group that Control.MousePosition
does not work relialby. Since you use DataGrid you are lucky - it has
MouseDown event, which passes as a parameter exact position
of a point where it was tapped.

--
DM

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Windows.Forms.DataGrid.HitTestInfo missing =?Utf-8?B?VG9tIFA=?= Microsoft C# .NET 2 5th May 2004 01:41 AM
DataGrid HitTestInfo is missing Ofer B. Microsoft Dot NET Compact Framework 4 10th Dec 2003 02:25 PM
Is there a class like DataGrid.HitTestInfo for keyboard GG Microsoft C# .NET 1 7th Oct 2003 10:05 PM
DataGrid.HitTestInfo Bob Krauth Microsoft Dot NET Framework Forms 2 19th Sep 2003 02:49 PM
Cant use DataGrid.HitTestInfo Ibai Peņa Microsoft Dot NET Compact Framework 0 18th Aug 2003 10:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:58 PM.