示例#1
0
        protected virtual void OnDraw(bool ResumeView)
        {
            if (this.ReversibleShape == ReversibleShapeStyle.Custom)
            {
                if (Draw != null)
                {
                    CaptureMouseMoveEventArgs args = this.CreateArgs();
                    args.ResumeView = ResumeView;
                    Draw(this, args);
                }
            }
            else
            {
                ReversibleDrawer drawer = null;
                if (myBindControl == null)
                {
                    drawer = ReversibleDrawer.FromScreen();
                }
                else
                {
                    drawer = ReversibleDrawer.FromHwnd(myBindControl.Handle);
                }

                drawer.PenStyle  = PenStyle.PS_SOLID;
                drawer.PenColor  = Color.White;
                drawer.LineWidth = 1;

                Rectangle rect = GetRectangle(this.StartPosition, this.CurrentPosition);
                switch (this.ReversibleShape)
                {
                case ReversibleShapeStyle.Rectangle:
                    drawer.DrawRectangle(rect);
                    break;

                case ReversibleShapeStyle.Ellipse:
                    drawer.DrawEllipse(rect);
                    break;

                case ReversibleShapeStyle.Line:
                    drawer.DrawLine(this.StartPosition, this.CurrentPosition);
                    break;

                case ReversibleShapeStyle.FillRectangle:
                    drawer.FillRectangle(rect);
                    break;
                }
                drawer.Dispose();
            }
        }
示例#2
0
        /// <summary>
        /// 绘制可逆矩形
        /// </summary>
        protected override void OnDraw(bool ResumeView)
        {
            base.OnDraw(ResumeView);
            if (bolCustomAction)
            {
                return;
            }
            ReversibleDrawer drawer = null;

            if (myBindControl != null)
            {
                drawer = ReversibleDrawer.FromHwnd(myBindControl.Handle);
            }
            else
            {
                drawer = ReversibleDrawer.FromScreen();
            }
            drawer.DrawRectangle(myDescRectangle);
            drawer.Dispose();
        }