Answer the question
In order to leave comments, you need to log in
How to find out the location of the cursor?
How do I get the coordinates of the mouse relative to panel ( panel is a component in winforms, I think everyone knows), when reading the KeyEventArgs event . I'll give you an example.
private void button_KeyDown(object sender, KeyEventArgs e)
{
// Тут надо роспознать кординати миши относительно Panel
}
Answer the question
In order to leave comments, you need to log in
Long story short, I found a workaround.
int CursorToFormX = this.PointToClient(Cursor.Position).X;
int CursorToFormY = this.PointToClient(Cursor.Position).Y;
int SizeTreeView = treeView1.Size.Width + 18;
int PositionPasteX = (SizeTreeView - CursorToFormX) - (SizeTreeView - CursorToFormX) - (SizeTreeView - CursorToFormX);
int SizeCaptionAndMenuStrip = int.Parse(SystemInformation.CaptionHeight.ToString()) + 6;
int PositionPasteY = (SizeCaptionAndMenuStrip - CursorToFormY) - (SizeCaptionAndMenuStrip - CursorToFormY) - (SizeCaptionAndMenuStrip - CursorToFormY);
/Получаем координаты курсора
int CX = Cursor.Position.X;
int CY = Cursor.Position.Y;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question