示例#1
0
文件: WindowSelector.cs 项目: sbec/KB
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                Point pt = Cursor.Position;

                IntPtr childWindow = WindowFromPoint(pt);
                WindowInfo CurWindow = new WindowInfo(GetAncestor(childWindow, GA_ROOT));

                if(CurWindow.Equals(LastWindow) == false)
                    OnWindowOver(new WindowSelect_EventArgs(CurWindow));

                if (LastWindow == null)
                {
                    ControlPaint.DrawReversibleFrame(CurWindow.Rect, WindowOutlineColor, WindowOutlineFrameStyle);
                }
                else if (CurWindow.Equals(LastWindow) == false)
                {
                    ControlPaint.DrawReversibleFrame(LastWindow.Rect, WindowOutlineColor, WindowOutlineFrameStyle);
                    ControlPaint.DrawReversibleFrame(CurWindow.Rect, WindowOutlineColor, WindowOutlineFrameStyle);
                }

                LastWindow = CurWindow;
                Cursor.Current = Cursors.Cross;
            }

            base.OnMouseMove(e);
        }
示例#2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                Point pt = Cursor.Position;

                IntPtr     childWindow = WindowFromPoint(pt);
                WindowInfo CurWindow   = new WindowInfo(GetAncestor(childWindow, GA_ROOT));

                if (CurWindow.Equals(LastWindow) == false)
                {
                    OnWindowOver(new WindowSelect_EventArgs(CurWindow));
                }

                if (LastWindow == null)
                {
                    ControlPaint.DrawReversibleFrame(CurWindow.Rect, WindowOutlineColor, WindowOutlineFrameStyle);
                }
                else if (CurWindow.Equals(LastWindow) == false)
                {
                    ControlPaint.DrawReversibleFrame(LastWindow.Rect, WindowOutlineColor, WindowOutlineFrameStyle);
                    ControlPaint.DrawReversibleFrame(CurWindow.Rect, WindowOutlineColor, WindowOutlineFrameStyle);
                }

                LastWindow     = CurWindow;
                Cursor.Current = Cursors.Cross;
            }

            base.OnMouseMove(e);
        }