Struct WndSavedRect
Helps to save and restore window rectangle and state. Ensures in screen, per-monitor-DPI-aware, etc.
public struct WndSavedRect
Examples
WPF window created with wpfBuilder.
const string c_rkey = @"HKEY_CURRENT_USER\Software\Au\Test", c_rvalue = @"Wpf7.Rect";
var b = new wpfBuilder("Window").WinSize(400).R.AddOkCancel().End();
WndSavedRect.Restore(b.Window, Registry.GetValue(c_rkey, c_rvalue, null) as string, s1 => Registry.SetValue(c_rkey, c_rvalue, s1));
//the same
//b.WinSaved(Registry.GetValue(c_rkey, c_rvalue, null) as string, s1 => Registry.SetValue(c_rkey, c_rvalue, s1));
if (!b.ShowDialog()) return;
Namespace: Au.More
Assembly: Au.dll
Constructors
Name | Description |
---|---|
WndSavedRect(wnd) | Gets window rectangle and state for saving. Usually called when closing the window. See also WndSavedRect.ToString. |
WndSavedRect(Form) | Gets window rectangle and state for saving. Usually called when closing the window. See also WndSavedRect.ToString. |
WndSavedRect(Window) | Gets window rectangle and state for saving. Usually called when closing the window. See also WndSavedRect.ToString. |
Properties
Name | Description |
---|---|
Dpi | |
IsToolWindow | wnd.IsToolWindow. If |
Maximize | The window should be maximized. |
RawRect | Window rectangle in normal state (not maximized/minimized), as retrieved by API GetWindowPlacement. |
Methods
Name | Description |
---|---|
FromString(string, out WndSavedRect) | Creates WndSavedRect from string created by WndSavedRect.ToString. |
NormalizeRect() | Gets real rectangle for restoring saved window rectangle. |
Restore(Form, string, Action<string>) | Calls WndSavedRect.FromString. If it returns |
Restore(Window, string, Action<string>) | Calls WndSavedRect.FromString. If it returns |
ToString() | Converts this object to string for saving.
The string is very simple, like |