示例#1
0
 static public void SetWindowBounds(IntPtr handle, WindowRect rect)
 {
     if (!MoveWindow(handle, rect.X1, rect.Y1, rect.X2 - rect.X1, rect.Y2 - rect.Y1, true))
     {
         throw new InvalidOperationException();
     }
 }
示例#2
0
        void ClingToMaster(uint msg)
        {
            if (Interop.IsWindow(masterHandle))
            {
                try
                {
                    switch (msg)
                    {
                    case 0x07:
                        this.Topmost = true;
                        this.Topmost = false;
                        Interop.SetForegroundWindow(masterHandle);
                        break;

                    case 0x08:
                        break;

                    default:
                        if (Interop.IsIconic(masterHandle))
                        {
                            this.WindowState = WindowState.Minimized;
                        }
                        else
                        {
                            this.WindowState = WindowState.Normal;
                            WindowRect r = Interop.GetWindowBounds(masterHandle);
                            Interop.SetWindowBounds(thisHandle, new WindowRect(r.X2, r.Y1, r.X2 + (int)this.Width, r.Y2));
                            this.Opacity = 1.0f;
                        }
                        break;
                    }
                }
                catch
                {
                    Dispatcher.InvokeShutdown();
                }
            }
        }
示例#3
0
 public static void SetWindowBounds(IntPtr handle, WindowRect rect)
 {
     if (!MoveWindow(handle, rect.X1, rect.Y1, rect.X2 - rect.X1, rect.Y2 - rect.Y1, true))
         throw new InvalidOperationException();
 }
示例#4
0
 static extern bool GetWindowRect(IntPtr hWnd, out WindowRect lpRect);
示例#5
0
 static extern bool GetWindowRect(IntPtr hWnd, out WindowRect lpRect);