DrawingArea的MouseButton的状态

时间:2012-12-10 07:43:31

标签: c# multithreading gtk#

我想用鼠标在DrawingArea中绘制图像。我可以在DrawingArea中知道当前的鼠标坐标,但我怎么知道按下了什么鼠标按钮?我目前的代码如下:

            protected void OnPaintedPicture1DrawingareaMotionNotifyEvent (object o, MotionNotifyEventArgs args)
            {
                EventMotion currentEventMotion = (args.Args[0] as EventMotion);

                matchingPercentageForPicture1AndSample1_entry.Text+=String.Format("x='{0}'; y='{1}';\t", currentEventMotion.X, currentEventMotion.Y);
            }

2 个答案:

答案 0 :(得分:0)

BOOL CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
  switch(LOWORD(wp))
   {
    case WM_LBUTTONDOWN:

继我的评论之后我发现了这个.. http://www.codeproject.com/Tips/400920/Handling-WM_LBUTTONUP-WM_LBUTTONDOWN-Messages-for

答案 1 :(得分:0)

您可以从currentEventMotion.State获取有关鼠标按钮(和修改键)的信息。它包含值Gdk.ModifierType

相关问题