-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