Esempio n. 1
0
 protected virtual void OnMoving(MovingEventArgs mea)
 {
     if (Moving != null)
     {
         Moving(this, mea);
     }
 }
		protected virtual void OnMoving(MovingEventArgs mea)
		{
			if (Moving != null)
			{
				Moving(this, mea);
			}
		}
Esempio n. 3
0
        /*
         * OurWndProc
         */

        private void OurWndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WinUser.WM_MOVING:
            {
                unsafe
                {
                    Int32 *   p    = (Int32 *)m.LParam;
                    Rectangle rect = Rectangle.FromLTRB(p[0], p[1], p[2], p[3]);

                    MovingEventArgs mea = new MovingEventArgs(rect);
                    OnMoving(mea);

                    p[0] = mea.Rectangle.Left;
                    p[1] = mea.Rectangle.Top;
                    p[2] = mea.Rectangle.Right;
                    p[3] = mea.Rectangle.Bottom;

                    m.Result = new IntPtr(1);
                }
                break;
            }

            // WinForms doesn't handle this message correctly and wrongly returns 0 instead of 1.
            case WinUser.WM_QUERYENDSESSION:
            {
                CancelEventArgs e = new CancelEventArgs();
                OnQueryEndSession(e);
                m.Result = e.Cancel ? IntPtr.Zero : new IntPtr(1);
                break;
            }

            default:
            {
                base.WndProc(ref m);
                break;
            }
            }
        }
		/*
		 * OurWndProc
		 */

		private void OurWndProc(ref Message m)
		{
			switch (m.Msg)
			{
				case WinUser.WM_MOVING:
				{
					unsafe
					{
						Int32* p = (Int32*)m.LParam;
						Rectangle rect = Rectangle.FromLTRB(p[0], p[1], p[2], p[3]);

						MovingEventArgs mea = new MovingEventArgs(rect);
						OnMoving(mea);

						p[0] = mea.Rectangle.Left;
						p[1] = mea.Rectangle.Top;
						p[2] = mea.Rectangle.Right;
						p[3] = mea.Rectangle.Bottom;

						m.Result = new IntPtr(1);
					}
					break;
				}
				// WinForms doesn't handle this message correctly and wrongly returns 0 instead of 1.
				case WinUser.WM_QUERYENDSESSION:
				{
					CancelEventArgs e = new CancelEventArgs();
					OnQueryEndSession(e);
					m.Result = e.Cancel ? IntPtr.Zero : new IntPtr(1);
					break;
				}
				default:
				{
					base.WndProc(ref m);
					break;
				}
			}
		}