示例#1
0
        private void pictureBoxMain_MouseDown(object sender, MouseEventArgs e)
        {
            pictureBoxMain.Focus();

            bool localUpdate = (currModule != null) &&
                               currModule.HasPixelUpdate &&
                               (ModifierKeys & Keys.Control) > 0;
            Cursor cursor;

            if (localUpdate)
            {
                panAndZoom.OnMouseDown(e, recomputePixel, e.Button == MouseButtons.Left,
                                       ModifierKeys, out cursor);
            }
            else
            {
                panAndZoom.OnMouseDown(e, imageProbe, e.Button == MouseButtons.Left,
                                       ModifierKeys, out cursor);
            }

            // Module's mouse handling.
            if (currModule != null &&
                currModule.MouseDown != null)
            {
                currModule.MouseDown(sender, transformMouseEvent(e));
            }

            if (cursor != null)
            {
                Cursor = cursor;
            }
        }
示例#2
0
文件: FormMain.cs 项目: Woprok/grcis
        private void pictureBoxMain_MouseDown(object sender, MouseEventArgs e)
        {
            pictureBoxMain.Focus();

            // MT-safe currentModule.
            IRasterModule cm = currModuleSafe();

            bool   isCtrl         = (ModifierKeys & Keys.Control) > 0;
            bool   isModule       = cm != null;
            bool   hasPixelUpdate = isModule && cm.HasPixelUpdate;
            bool   leftButton     = e.Button == MouseButtons.Left;
            Cursor cursor;

            if (hasPixelUpdate &&
                isCtrl)
            {
                panAndZoom.OnMouseDown(e, recomputePixel, leftButton,
                                       ModifierKeys, out cursor);
            }
            else
            {
                panAndZoom.OnMouseDown(e, imageProbe, leftButton,
                                       ModifierKeys, out cursor);
            }

            // Warning for Ctrl+Mouse without currModule.HasPixelUpdate.
            if (isCtrl &&
                isModule &&
                !hasPixelUpdate)
            {
                SetText($"Current module '{ModuleRegistry.DecoratedModuleName(cm)}' has no PixelUpdate()");
            }

            // Module's mouse handling.
            if (isModule &&
                cm.MouseDown != null)
            {
                cm.MouseDown(sender, transformMouseEvent(e));
            }

            if (cursor != null)
            {
                Cursor = cursor;
            }
        }