1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- namespace System.Windows.Forms
- {
- public class SystemWindow : Window, IForm
- {
- public System.Windows.Controls.ContentControl ContentControl => this;
- public bool ExtendedAppArea { get; set; } // not supported
- public double ExtendedAppAreaSize { get; set; } // not supported
- public System.Drawing.Size ClientSizeDelta => NativeMethods.GetClientSizeDelta(this);
- private FormBorderStyle formBorderStyle;
- public FormBorderStyle FormBorderStyle
- {
- get => formBorderStyle;
- set
- {
- formBorderStyle = value;
- ResizeMode = value == FormBorderStyle.FixedDialog || value == FormBorderStyle.FixedToolWindow ? ResizeMode.NoResize : ResizeMode.CanResize;
- WindowStyle = value switch
- {
- FormBorderStyle.None => WindowStyle.None,
- FormBorderStyle.FixedToolWindow => WindowStyle.ToolWindow,
- FormBorderStyle.SizableToolWindow => WindowStyle.ToolWindow,
- _ => WindowStyle.SingleBorderWindow
- };
-
- if (value == FormBorderStyle.FixedDialog)
- {
- MinimizeBox = MaximizeBox = ShowIcon = false;
- }
- else if (value == FormBorderStyle.None)
- ResizeMode = ResizeMode.NoResize;
- }
- }
- public bool MaximizeBox { get; set; }
- public bool MinimizeBox { get; set; }
- public bool ShowIcon { get; set; }
- public SystemWindow()
- {
- Loaded += (s, e) => NativeMethods.RemoveWindowItems(this, ShowIcon, MinimizeBox, MaximizeBox);
- }
- }
- }
|