コード例 #1
0
		protected void CheckPosition(int helpWindow)
		{
			TraceUtil.WriteLineInfo(this, "Setting position: " + helpWindow);
			// If we have not heard of this window, set its size
			lock (this)
			{
				if (_windowsHash[helpWindow] == null)
				{
					_windowsHash.Add(helpWindow, helpWindow);
					Control c = ObjectBrowserForm.Instance;
					// Get placement (max, min, normal)
					WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
					wp.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
					Windows.GetWindowPlacement(c.Handle, ref wp);
					// Put the window in normal state if its not
					if (wp.showCmd != Windows.SW_SHOW_NORMAL)
					{
						wp.showCmd = Windows.SW_RESTORE;
						Windows.SetWindowPlacement(c.Handle, ref wp);
					}
					int deskTop = Windows.GetDesktopWindow();
					WINDOWINFO wi = new WINDOWINFO();
					wi.cbSize = Marshal.SizeOf(typeof(WINDOWINFO));
					Windows.GetWindowInfo(deskTop, ref wi);

					Rectangle p = c.Bounds;
					p.X = 0;
					p.Width = (int)wi.rcClient.right / 2;
					c.Bounds = p;
					// Set the size to split the width of the screen
					// between the two windows
					Windows.SetWindowPos(helpWindow,
										 Windows.HWND_TOP,
										 c.Bounds.X + c.Bounds.Width,
										 c.Bounds.Y,
										 wi.rcClient.right - c.Bounds.Width,
										 c.Bounds.Height,
										 0);
				}
			}
		}
コード例 #2
0
ファイル: Windows.cs プロジェクト: Erguotou/SharpDevelop
		public static extern bool GetWindowPlacement(IntPtr hwnd, ref WINDOWPLACEMENT wp);