コード例 #1
0
        public void doOnMouseUp(object sender)
        {
            //Form thisform = (Form)sender;
            PointPlotUserControl thisform = (PointPlotUserControl)sender;

            ControlPaint.DrawReversibleFrame(thisform.RectangleToScreen(SelectRect), Color.Black, FrameStyle.Dashed);
        }
コード例 #2
0
        public void clsLineRectangle_OnMouseDown(Object sender, MouseEventArgs e)
        {
            SelectRect.Width  = 0;
            SelectRect.Height = 0;
            SelectRect.X      = e.X;
            SelectRect.Y      = e.Y;

            ps.X      = e.X;
            ps.Y      = e.Y;
            pe        = ps;
            isBanding = true;
            isSquare  = !PointPlotUserControl.isAltKey(); //use Alt to make it not-square
        }
コード例 #3
0
        public void clsLineRectangle_OnMouseMove(Object sender, MouseEventArgs e)
        {
            if (isBanding && e.Button == MouseButtons.Left)
            {
                // Form thisform = (Form)sender;
                PointPlotUserControl thisform = (PointPlotUserControl)sender;

                // First DrawReversible to toggle to the background color
                // Second DrawReversible to toggle to the specified color

                ControlPaint.DrawReversibleFrame(thisform.RectangleToScreen(SelectRect), Color.Black, FrameStyle.Dashed);
                int    w     = e.X - SelectRect.X;
                int    h     = e.Y - SelectRect.Y;
                double ratio = PointPlotUserControl.RATIO; //0.75;
                if (isSquare)
                {
                    if (w * ratio == h)
                    {
                        SelectRect.Width  = w;
                        SelectRect.Height = h;
                    }
                    else if (w * ratio <= h)
                    {
                        SelectRect.Width  = (int)(h / ratio);
                        SelectRect.Height = h;
                    }
                    else
                    {
                        SelectRect.Width  = w;
                        SelectRect.Height = (int)(w * ratio);
                    }
                }
                else
                {
                    SelectRect.Width  = w;
                    SelectRect.Height = h;
                }
                ControlPaint.DrawReversibleFrame(thisform.RectangleToScreen(SelectRect), Color.Black, FrameStyle.Dashed);
            }
        }