Beispiel #1
0
        /// <summary>
        /// Timer ÊÓËÃѺ update ˹éÒ¨Í PointDummy àÇÅÒ CaptureControl ÁÕ¡ÒÃà»ÅÕè¹á»Å§
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer_Tick(object sender, EventArgs e)
        {
            //˹éÒ·Õè¢Í§ Timer ¤×ͤͨѺ´ÙÇèÒ Control ·ÕèµÃǨ¨ÑºÍÂÙè¹ÕéÁÕ¡ÒÃà»ÅÕè¹µÓá˹è§ÃÖà»ÅèÒ  à¾×èͤÍ Update ¢¹Ò´ PointDummy
            //áºè§¡Òà Update PointDummy ÍÍ¡à»ç¹ 2 ½Ñ觤×Í  ÁÕ¡ÒÃà¤Å×è͹ÂéÒ MessageDialog áÅÐÁÕ¡ÒÃà¤Å×è͹ÂéÒ·ÕèµÑÇ Control àͧ

            if (IsMoving)
            {
                //¶éÒÁÕ¡ÒÃà¤Å×è͹ÂéÒ Form ÍÂÙè ¨Ð»Ô´¡Ò÷ӧҹ¢Í§ Timer
                PointDummyForm.SetAlpha(0);
            }
            else if (!IsMoving && HandleCaptureControl != IntPtr.Zero)
            {
                if (PointDummyForm.AlphaLevel == 0)
                {
                    PointDummyForm.SetAlpha(255);
                    Win32.SetForegroundWindow(Handle);

                    this.Invalidate(true);
                }

                //¶éÒµÓá˹è§áÅТ¹Ò´äÁèµÃ§¡Ñº¤èÒÅèÒÊØ´  ¨ÐµéͧÁÕ¡Òà Update
                else if (!m_rectLast.Equals(CaptureControlRectangle))
                {
                    //à¡çº Control à¡Ô¹¢Íºà¢µ¡ÒÃáÊ´§¼Å ¨Ð«è͹ PointDummy áÅÐ MessageDialog
                    if (CaptureControlRectangle.Right < 0 ||
                        CaptureControlRectangle.Bottom < 0 ||
                        CaptureControlRectangle.Left > Screen.FromHandle(HandleCaptureControl).WorkingArea.Right ||
                        CaptureControlRectangle.Top > Screen.FromHandle(HandleCaptureControl).WorkingArea.Bottom)
                    {
                        PointDummyForm.Visible = false;
                        this.Visible           = false;
                        return;
                    }
                    else
                    {
                        //à¡çº Window ·Õè¡ÓÅѧ Capture mouse äÇéÍÂÙè
                        IntPtr ptr = Win32.GetCapture();

                        PointDummyForm.Visible = true;
                        this.Visible           = true;

                        // SetForeground ä»Âѧ window µÑÇ·Õè¡ÓÅѧà¤Å×è͹µÓá˹è§
                        Win32.SetForegroundWindow(ptr);
                    }

                    int deltaX = CaptureControlRectangle.Left - m_rectLast.Left;
                    int deltaY = CaptureControlRectangle.Top - m_rectLast.Top;
                    OffsetPointDummy(deltaX, deltaY);
                    OffsetDialog(deltaX, deltaY);

                    //»ÃѺ»Ãا Rect ¢Í§ PointDummy ãËé¾Í´Õ¡Ñº Control ·Õèà»ÅÕè¹ä»
                    //UpdateClientRectanglePointDummy(m_rectLast);

                    //à¡çº¤èÒµÓá˹觵ÓáË¹è§ áÅТ¹Ò´ãËÁè
                    m_rectLast = CaptureControlRectangle;
                } // end if : àªç¤ Equal ¢Í§ CaptureControl Rectangle
            }
        }
Beispiel #2
0
        private void pnlTitle_MouseDown(object sender, MouseEventArgs e)
        {
            m_bMove = true;

            PointDummyForm.SetAlpha(0);

            Application.DoEvents();

            int WM_NCLBUTTONDOWN = 0x00A1;

            if (e.Button == MouseButtons.Left)
            {
                Win32.ReleaseCapture();
                Win32.SendMessage(this.Handle, WM_NCLBUTTONDOWN, new IntPtr(2), IntPtr.Zero);

                SetAlpha(255);
                m_bMove = false;
            }

            //Show PointDummyForm again in timer_tick() event when mouse up.
        }