public TitlebarButtonHosterForm(NativeUnmanagedWindow parent) { AutoScaleMode = AutoScaleMode.None; ParentWindow = parent; Show(NativeWindow.FromHandle(parent.Handle)); Attach(parent); SetBitmap(NativeThemeUtils.GetDwmWindowButton(AeroTitlebarButtonPart.MinimizeButton, TitlebarButtonState.Hot) as Bitmap); }
private void Attach(NativeUnmanagedWindow parent) { parent.WindowChanged += (s, e) => Relocate(this, parent); SetWindowPos(new HandleRef(this, Handle), parent.Handle, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOMOVE); NativeThemeUtils.SetWindowLong(Handle, NativeThemeUtils.GWLParameter.GWL_HWNDPARENT, parent.Handle.ToInt32()); Relocate(this, parent); }
public SafeNativeWindowHandle(NativeWindow w = null) : base(DestroyHandle) { NativeWindow = w ?? NativeThemeUtils.CreateNativeWindow(); SetHandle(NativeWindow.Handle); ToFree.Add(NativeWindow.Handle, NativeWindow); }