예제 #1
0
        private void MessageDialogBase_FormClosed(object sender, FormClosedEventArgs e)
        {
            timer.Enabled = false;

            ////Destroy PointDummy
            PointDummyForm.Close();
            PointDummyForm.Dispose();
        }
예제 #2
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
            }
        }
예제 #3
0
        /// <summary>
        /// Remove menu from SysCommand SC_CLOSE
        /// </summary>
        //private void RemoveCloseButton()
        //{
        //    //Obtain the handle to the form's system menu
        //    IntPtr hMenu = Win32.GetSystemMenu(Handle.ToInt32(), false);

        //    //Get the count of the items in the system menu.
        //    IntPtr menuItemCount = Win32.GetMenuItemCount(hMenu.ToInt32());

        //    //Remove the close menuitem.
        //    Win32.RemoveMenu(hMenu.ToInt32(), menuItemCount.ToInt32() - 1, Win32.MF_DISABLED | Win32.MF_BYPOSITION);

        //    //Remove the Separetor
        //    Win32.RemoveMenu(hMenu.ToInt32(), menuItemCount.ToInt32() - 2, Win32.MF_DISABLED | Win32.MF_BYPOSITION);

        //    //redraw the menu bar
        //    Win32.DrawMenuBar(Handle.ToInt32());
        //}

        private void UpdateClientRectanglePointDummy()
        {
            PointDummyForm.ClearLine();

            if (HandleCaptureControl == IntPtr.Zero)
            {
                PointDummyForm.Location = new Point(0, 0);
                PointDummyForm.Size     = new Size(3, 3);
                return;
            }
        }
예제 #4
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.
        }
예제 #5
0
        private void MessageDialogBase_Shown(object sender, EventArgs e)
        {
            if (this.Owner != null)
            {
                // áÊ´§Ë¹éÒ¨Í Point Dummy
                PointDummyForm.Show(this.Owner);
            }
            else
            {
                PointDummyForm.Show();
                PointDummyForm.Owner = null;
                this.Owner           = null;
            }

            this.UpdateClientRectanglePointDummy();
            Win32.SetForegroundWindow(Handle);

            PlaySound();

            pnlButtonContainer.Controls[(int)MessageDialogDefaultButton].Focus();

            this.Invalidate(true);
        }