BUG: Ribbon Window incompatible with SetWindowPlacement()

Ribbon for WPF Forum

Posted 9 years ago by SledgeHammer01
Version: 9.2.0514
Platform: Silverlight Controls
Environment: Windows XP (32-bit)
Avatar
In order to save / restore the main application window, we use (via interop) the GetWindowPlacement() / SetWindowPlacement() APIs. We use this in OnSourceInitialized() as demonstrated by a Microsoft code sample. When the saved state is SW_SHOWMAXIMIZED, the window is restored to the maximized state correctly, BUT, the frame retains its rounded corners window region. Maximizing via double clicking the caption bar removes the rounded corner window region and squares off the corners as expected. I was able to work around this by adding a call to WindowState = WindowState.Maximized; in the case of SW_SHOWMAXIMZIED, but thought I would report the bug nonetheless.

Code Snippet:

protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);

// restore the window position

WINDOWPLACEMENT wp = (WINDOWPLACEMENT)Properties.Settings.Default.WindowPlacement;
wp.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
wp.flags = 0;
wp.showCmd = ( wp.showCmd == SW_SHOWMINIMIZED ? SW_SHOWNORMAL : wp.showCmd);
IntPtr hwnd = new WindowInteropHelper(this).Handle;
SetWindowPlacement(hwnd, ref wp);


EDIT: The sample I am referring to is here. It contains all the interop definitions:

http://msdn.microsoft.com/en-us/library/aa972163.aspx

[Modified at 03/04/2010 02:39 PM]

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks for the note, we'll mark it down.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.