-1
我正在使用bmp,但我打开其他建议,因为我在搜索bmp交互时几乎找不到任何信息。与图纸互动
我终于绘出我的画成pictureBox
一切工作正常,但是当我点击该图,我想读哪里是在BMP指针。如果它在显示图上方,我会想把它放在X位置。
编辑: 另一个并不重要,但有趣的问题: 是否有可能坚持鼠标位置,只要它在bmp上方,只能移动到图形函数的上方或下方?
我正在使用bmp,但我打开其他建议,因为我在搜索bmp交互时几乎找不到任何信息。与图纸互动
我终于绘出我的画成pictureBox
一切工作正常,但是当我点击该图,我想读哪里是在BMP指针。如果它在显示图上方,我会想把它放在X位置。
编辑: 另一个并不重要,但有趣的问题: 是否有可能坚持鼠标位置,只要它在bmp上方,只能移动到图形函数的上方或下方?
我发现我自己的答案,在这里:)
private void obterposicaonografico()
{
// Set the Current cursor, and display how many points in X axis you took
this.Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X, Cursor.Position.Y);
MessageBox.Show(Cursor.Position.X.ToString());
//Define it's position on X axis, subtracting the whole form X location
//This will ensure that if the user moves the form around, it will still be relative to the own form
//and not the windows positioning
decimal posicaoX = Cursor.Position.X -this.Location.X
MessageBox.Show(Cursor.Position.X.ToString());
}
看一看在你的图片框的MouseDown事件的MouseEventArgs参数。这应该让你开始朝正确的方向发展。 – Ulric 2015-04-03 03:54:16
我已经在上面了,无论如何,我会为他们发布一个解决方案newbz;) – ng80092b 2015-04-03 05:51:15