Beispiel #1
0
		internal static System.Drawing.Size GetNonClientArea(IntPtr hwnd) {
			var c = new NativePoint();

			TabbedThumbnailNativeMethods.ClientToScreen(hwnd, ref c);

			var r = new NativeRect();

			TabbedThumbnailNativeMethods.GetWindowRect(hwnd, ref r);

			return new System.Drawing.Size(c.X - r.Left, c.Y - r.Top);
		}
Beispiel #2
0
		/// <summary>
		/// Sizes the native control to match the WinForms control wrapper.
		/// </summary>
		/// <param name="e">Contains information about the size changed event.</param>
		protected override void OnSizeChanged(EventArgs e) {
			if (explorerBrowserControl != null) {
				NativeRect rect = new NativeRect();
				rect.Top = ClientRectangle.Top;
				rect.Left = ClientRectangle.Left;
				rect.Right = ClientRectangle.Right;
				rect.Bottom = ClientRectangle.Bottom;

				IntPtr ptr = IntPtr.Zero;
				explorerBrowserControl.SetRect(ref ptr, rect);
			}

			base.OnSizeChanged(e);
		}
Beispiel #3
0
		/// <summary>
		/// Creates and initializes the native ExplorerBrowser control
		/// </summary>
		protected override void OnCreateControl() {
			base.OnCreateControl();

			if (this.DesignMode == false) {
				explorerBrowserControl = new ExplorerBrowserClass();

				// hooks up IExplorerPaneVisibility and ICommDlgBrowser event notifications
				ExplorerBrowserNativeMethods.IUnknown_SetSite(explorerBrowserControl, this);

				// hooks up IExplorerBrowserEvents event notification
				explorerBrowserControl.Advise(
					Marshal.GetComInterfaceForObject(this, typeof(IExplorerBrowserEvents)),
					out eventsCookie);

				// sets up ExplorerBrowser view connection point events
				viewEvents = new ExplorerBrowserViewEvents(this);

				NativeRect rect = new NativeRect();
				rect.Top = ClientRectangle.Top;
				rect.Left = ClientRectangle.Left;
				rect.Right = ClientRectangle.Right;
				rect.Bottom = ClientRectangle.Bottom;

				explorerBrowserControl.Initialize(this.Handle, ref rect, null);

				// Force an initial show frames so that IExplorerPaneVisibility works the first time it is set.
				// This also enables the control panel to be browsed to. If it is not set, then navigating to 
				// the control panel succeeds, but no items are visible in the view.
				explorerBrowserControl.SetOptions(ExplorerBrowserOptions.ShowFrames);

				explorerBrowserControl.SetPropertyBag(propertyBagName);

				if (antecreationNavigationTarget != null) {
					BeginInvoke(new MethodInvoker(
					delegate {
						Navigate(antecreationNavigationTarget);
						antecreationNavigationTarget = null;
					}));
				}
			}

			Application.AddMessageFilter(this);
		}
		public virtual extern void SetRect([In, Out] ref IntPtr phdwp, NativeRect rcBrowser);