You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ffed591
Browse filesBrowse the repository at this point in the historyBrowse files
For controls derived from `TextBoxBase`, `Padding` affects the text layout when the effective visual styles mode is `VisualStylesMode.Net11` or later. The property is now available in the Windows Forms Designer's Properties window and is serialized into generated Designer code. This is not a binary breaking change: the existing `Padding` property is retained. It remains ineffective for text layout in `Classic` and `Disabled` modes.
71
71
72
-
What's important for layouting your Form and UserControls: Modern chrome can and will change preferred sizes, padding, and layout. Auto-sized and intrinsically sized controls request layout updates automatically, while fixed-size multiline text boxes can have a slightly smaller client area. Prefer `TableLayoutPanel` and `FlowLayoutPanel` over pixel-perfect sizing; see the [layout guidance](https://github.com/dotnet/winforms/blob/main/docs/net11-visualstyles-layout-guidance.md).
72
+
When laying out forms and user controls, keep in mind that modern chrome can and will change preferred sizes, padding, and layout. Auto-sized and intrinsically sized controls request layout updates automatically, while fixed-size multiline text boxes can have a slightly smaller client area. Prefer `TableLayoutPanel` and `FlowLayoutPanel` over pixel-perfect sizing; see the [layout guidance](https://github.com/dotnet/winforms/blob/main/docs/net11-visualstyles-layout-guidance.md).
73
73
74
-
Using `VisualStylesMode` with setings >= `NET11`_will_ break pixel-perfect layouts.
75
-
That is expected and the nature of the beast - but: You can use Copilot or other AI-based tooling options to refactor pixel-perfect layout approaches into Fluent layouts based on the TableLayoutPanel control. Please also consider to that add new WinForms Skills, which we are actively working on, and whose preview versions you can already [find and use here](https://github.com/dotnet/skills/tree/main/plugins/dotnet-winforms/skills/winforms-expert).
74
+
Using `VisualStylesMode.Net11` or later _will_ break pixel-perfect layouts. This is expected. You can use Copilot or other AI tools to refactor pixel-perfect layouts into Fluent layouts based on the `TableLayoutPanel` control. You can also use the [preview WinForms skills](https://github.com/dotnet/skills/tree/main/plugins/dotnet-winforms/skills/winforms-expert), which are being actively developed.
76
75
77
76
The following APIs support custom controls and the framework's built-in rendering updates:
78
77
@@ -126,7 +125,7 @@ The toggle renderer takes precedence over `FlatStyle.System`. A `CheckBox` with
126
125
127
126
### Handle changes on the form or control
128
127
129
-
**Inside a form, use the inherited instance event `SystemVisualSettingsChanged`, not the static `Application.SystemVisualSettingsChanged` event.** The instance path follows the control's lifetime and needs no unsubscription when the control is disposed. A custom control can instead override `OnSystemVisualSettingsChanged(SystemVisualSettingsChangedEventArgs)` and call the base implementation.
128
+
**Inside a form, use the inherited instance event `SystemVisualSettingsChanged`, not the static `Application.SystemVisualSettingsChanged` event.** The instance path follows the control's lifetime and does not require unsubscribing when the control is disposed. A custom control can instead override `OnSystemVisualSettingsChanged(SystemVisualSettingsChangedEventArgs)` and call the base implementation.
130
129
131
130
```csharp
132
131
usingSystem.Windows.Forms;
@@ -163,7 +162,7 @@ public partial class MainForm : Form
163
162
164
163
`SystemVisualSettingsCategories` defines `None` (`0`), `AccentColor` (`1`), `TextScale` (`2`), `HighContrast` (`4`), `ClientAreaAnimations` (`8`), `KeyboardCues` (`16`), and `FocusMetrics` (`32`). Several flags can be combined in one transition.
165
164
166
-
WinForms normalizes Windows setting, accent-color, theme, and system-color notifications into settings transitions. The static `Application.SystemVisualSettingsChanged` event remains available for application-lifetime consumers such as theming engines and services; its sender is `null`. Shorter-lived consumers of that static event must unsubscribe to avoid lifetime leaks.
165
+
WinForms normalizes notifications about Windows settings, accent colors, themes, and system colors into settings transitions. The static `Application.SystemVisualSettingsChanged` event remains available for application-lifetime consumers such as theming engines and services; its sender is `null`. Shorter-lived consumers of that static event must unsubscribe to avoid lifetime leaks.
167
166
168
167
Instance notifications cascade through parented controls. An unparented control can miss a transition, so query `Application.SystemVisualSettings` when it is parented or creates its handle. High Contrast changes also trigger visual-style processing for controls whose effective renderer changes.
169
168
@@ -297,7 +296,7 @@ Custom controls can override the protected `Control.BeginSuspendPaintingCore()`
297
296
|`OnContainerControlChanged(EventArgs)` / `OnFullScreenChanged(EventArgs)`| Protected virtual hooks that raise the corresponding events. |
298
297
|`Dispose(bool)`| Releases the component's runtime resources and subscriptions. |
299
298
300
-
Keyboard shortcuts are evaluated only while the managed form or a child has input focus. Keyboard and mouse activity is observed through the application's message queue, not global hooks or system-wide hot keys.
299
+
Keyboard shortcuts are evaluated only while the managed form or a child has input focus. Keyboard and mouse activity are observed through the application's message queue, not global hooks or system-wide hot keys.
301
300
302
301
```csharp
303
302
usingSystem.Windows.Forms;
@@ -321,7 +320,7 @@ Application.Run(form);
321
320
322
321
**This component is not a security boundary.** It does not guarantee that users cannot interrupt the application, switch applications, or access the operating system. Secure kiosk lockdown must be configured at the Windows/system level by an IT administrator.
323
322
324
-
Windows 11 offers kiosk setup through **Windows > Settings > Accounts > Other users > Set up a kiosk > Get started**:
323
+
Windows 11 offers kiosk setup through **Windows > Settings > Accounts > Other users > Set up a kiosk > Get started**.
325
324
326
325
The Windows kiosk configuration is separate from `KioskModeManager`. The Settings single-app Assigned Access experience supports eligible UWP applications or Microsoft Edge; it is not a way to select any arbitrary WinForms executable. Administrators should choose the appropriate Windows kiosk/restricted-user configuration for the deployment and Windows edition. See [Configure a single-app kiosk with Assigned Access](https://learn.microsoft.com/en-us/windows/configuration/assigned-access/configure-single-app-kiosk).
0 commit comments