Skip to content

Commit 7ab6dde

Browse files
adegeogewarren
andauthored
Freshness pass winforms (#2054)
* table test * Acro and various fixes; update dates * Convert a table to normal style * First pass on upgrading target projects * Finished up automatic updates * Fixes * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> * Update dotnet-desktop-guide/net/winforms/input-keyboard/overview.md Co-authored-by: Genevieve Warren <[email protected]> * Update dotnet-desktop-guide/net/winforms/input-keyboard/overview.md Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: Genevieve Warren <[email protected]>
1 parent 6bb5e19 commit 7ab6dde

File tree

132 files changed

+519
-583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+519
-583
lines changed

dotnet-desktop-guide/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ metadata:
1010
ms.product: dotnet
1111
author: adegeo
1212
ms.author: adegeo
13-
ms.date: 11/11/2024
13+
ms.date: 04/02/2025
1414

1515
# linkListType: architecture | concept | deploy | download | get-started | how-to-guide | learn | overview | quickstart | reference | sample | tutorial | video | whats-new
1616

dotnet-desktop-guide/net/winforms/controls-design/designer-differences-framework.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Designers changes from .NET Framework
33
description: Learn about the Windows Forms designer changes from .NET Framework to .NET.
4-
ms.date: 11/14/2024
4+
ms.date: 04/02/2025
55
ms.topic: overview
66
no-loc: ["UserControl", "UserControl1", "UserControlProject", "Label", "Button", "Form", "TextBox"]
77
dev_langs:

dotnet-desktop-guide/net/winforms/controls-design/designer-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Design-time error troubleshooting
33
description: Learn about some of the common errors that occur when the Windows Forms Designer fails to load. This article might help you troubleshoot those errors.
4-
ms.date: 07/19/2023
4+
ms.date: 04/01/2025
55
ms.topic: troubleshooting
66
f1_keywords:
77
- "DTELErrorList"

dotnet-desktop-guide/net/winforms/controls-design/designer-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Visual Studio Design-time overview
33
description: Learn about what capabilities are available in Visual Studio for Windows Forms designer support with your custom controls.
4-
ms.date: 06/01/2023
4+
ms.date: 04/01/2025
55
ms.topic: overview
66
no-loc: ["UserControl", "UserControl1", "UserControlProject", "Label", "Button", "Form", "TextBox"]
77
dev_langs:
@@ -30,7 +30,7 @@ Many basic design elements of custom controls have remained the same from .NET F
3030

3131
Visual Studio is a .NET Framework-based application, and as such, the Visual Designer you see for Windows Forms is also based on .NET Framework. With a .NET Framework project, both the Visual Studio environment and the Windows Forms app being designed run within the same process, **devenv.exe**. This poses a problem when you're working with a Windows Forms .NET (not .NET Framework) app. Both .NET and .NET Framework can't work within the same process. As a result, Windows Forms .NET uses a different designer, the "out-of-process" designer.
3232

33-
The out-of-process designer is a process called **DesignToolsServer.exe**, and is run along-side Visual Studio's **devenv.exe** process. The **DesignToolsServer.exe** process runs in the same version and platform, such as .NET 9 and x64, of .NET that your app is targeting. When your custom control needs to display UI in the **devenv.exe** your custom control must implement a client-server architecture to facilitate the communication to and from **devenv.exe**. For more information, see [The designer changes since .NET Framework (Windows Forms .NET)](designer-differences-framework.md).
33+
The out-of-process designer is a process called **DesignToolsServer.exe**, and is run alongside Visual Studio's **devenv.exe** process. The **DesignToolsServer.exe** process runs in the same version and platform, such as .NET 9 and x64, of .NET that your app is targeting. When your custom control needs to display UI in Visual Studio, your custom control must implement a client-server architecture to facilitate the communication to and from **devenv.exe**. For more information, see [The designer changes since .NET Framework](designer-differences-framework.md).
3434

3535
## Property window
3636

dotnet-desktop-guide/net/winforms/controls-design/designer-properties-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Design-time properties overview
33
description: Learn about how the Windows Forms Designer interacts with control and form properties during design-time.
4-
ms.date: 07/14/2023
4+
ms.date: 04/02/2025
55
ms.topic: overview
66
no-loc: ["UserControl"]
77
dev_langs:
@@ -123,4 +123,4 @@ This should be converted into examples
123123
The **Properties** window automatically uses a type editor for a property when the type of the property is a built-in or known type. For example, a boolean value is edited as a combo box with **True** and **False** values and the <xref:System.DateTime> type uses a calendar dropdown.
124124

125125
> [!IMPORTANT]
126-
> Custom type editors have changed since .NET Framework. For more information, see [The designer changes since .NET Framework (Windows Forms .NET)](designer-differences-framework.md).
126+
> Custom type editors have changed since .NET Framework. For more information, see [The designer changes since .NET Framework](designer-differences-framework.md).

dotnet-desktop-guide/net/winforms/controls-design/how-to-create-usercontrol.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: How to create a user control
33
description: This article teaches you how to create a user control, known as a composite control, that you can add to other forms.
4-
ms.date: 06/19/2023
4+
ms.date: 04/02/2025
55
ms.topic: how-to
66
no-loc: ["UserControl", "UserControl1", "UserControlProject", "Label", "Button", "Form", "TextBox"]
77
dev_langs:
@@ -47,6 +47,7 @@ The user control is made up of _constituent controls_, which are the controls yo
4747
01. With the designer open, the user control design surface should be the selected object. If it's not, click on the design surface to select it. Set the following properties in the **Properties** window:
4848

4949
> [!div class="mx-tableNormal"]
50+
>
5051
> | Property | Value |
5152
> |-------------|------------|
5253
> | MinimumSize | `84, 53` |
@@ -55,6 +56,7 @@ The user control is made up of _constituent controls_, which are the controls yo
5556
01. Add a **Label** control. Set the following properties:
5657

5758
> [!div class="mx-tableNormal"]
59+
>
5860
> | Property | Value |
5961
> |----------|------------|
6062
> | Name | `lblTitle` |
@@ -63,6 +65,7 @@ The user control is made up of _constituent controls_, which are the controls yo
6365
01. Add a **TextBox** control. Set the following properties:
6466

6567
> [!div class="mx-tableNormal"]
68+
>
6669
> | Property | Value |
6770
> |----------|------------|
6871
> | Name | `txtValue` |
@@ -73,6 +76,7 @@ The user control is made up of _constituent controls_, which are the controls yo
7376
01. Add a **Button** control. Set the following properties:
7477

7578
> [!div class="mx-tableNormal"]
79+
>
7680
> | Property | Value |
7781
> |----------|------------|
7882
> | Name | `btnClear` |
@@ -132,6 +136,7 @@ If you created a new project in the last section, you have a blank Form named **
132136
01. Select one control and set the following properties:
133137

134138
> [!div class="mx-tableNormal"]
139+
>
135140
> | Property | Value |
136141
> |----------|----------------|
137142
> | Name | `ctlFirstName` |
@@ -142,6 +147,7 @@ If you created a new project in the last section, you have a blank Form named **
142147
01. Select the other control and set the following properties:
143148

144149
> [!div class="mx-tableNormal"]
150+
>
145151
> | Property | Value |
146152
> |----------|---------------|
147153
> | Name | `ctlLastName` |
@@ -152,6 +158,7 @@ If you created a new project in the last section, you have a blank Form named **
152158
01. Back in the **Toolbox** window, add a label control to the form, and set the following properties:
153159

154160
> [!div class="mx-tableNormal"]
161+
>
155162
> | Property | Value |
156163
> |----------|---------------|
157164
> | Name | `lblFullName` |

dotnet-desktop-guide/net/winforms/controls-design/how-to-designer-properties-shouldserialize-reset.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: How to use the Reset and ShouldSerialize methods
33
description: Learn how to implement the Reset and ShouldSerialize methods to control a property during design-time in Windows Forms.
4-
ms.date: 07/20/2023
4+
ms.date: 04/02/2025
55
ms.topic: how-to
66
dev_langs:
77
- "csharp"

dotnet-desktop-guide/net/winforms/controls-design/how-to-set-toolbox-icon.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: How to set the toolbox icon
33
description: Learn how to assign your control's icon. The icon appears in the Visual Studio Toolbox.
4-
ms.date: 07/20/2023
4+
ms.date: 04/02/2025
55
ms.topic: how-to
66
dev_langs:
77
- "csharp"

dotnet-desktop-guide/net/winforms/controls-design/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Create custom controls overview
33
description: Learn about the different types of custom controls you can create in Windows Forms for .NET.
4-
ms.date: 06/01/2023
4+
ms.date: 04/02/2025
55
ms.topic: overview
66
f1_keywords:
77
- "UserControl"
@@ -117,7 +117,7 @@ If you need to implement a custom design-time experience, you can author your ow
117117

118118
Use the <xref:System.ComponentModel.DesignerAttribute> to associate your control with your designer.
119119

120-
The following information is out of date but may help you.
120+
The following information is out of date but it might help you.
121121

122122
- [(Visual Studio 2013) Extending Design-Time Support](/previous-versions/visualstudio/visual-studio-2013/37899azc(v=vs.120)).
123123
- [(Visual Studio 2013) How to: Create a Windows Forms Control That Takes Advantage of Design-Time Features](/previous-versions/visualstudio/visual-studio-2013/307hck25(v=vs.120)).

dotnet-desktop-guide/net/winforms/controls-design/snippets/designer-properties-overview/csharp/CompassRose.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public partial class CompassRose : UserControl
1414

1515
// <browsable>
1616
[Browsable(false)]
17+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
1718
public bool IsSelected { get; set; }
1819
// </browsable>
1920

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0-windows</TargetFramework>
4+
<TargetFramework>net9.0-windows</TargetFramework>
65
<Nullable>enable</Nullable>
76
<UseWindowsForms>true</UseWindowsForms>
87
<ImplicitUsings>enable</ImplicitUsings>
98
</PropertyGroup>
10-
119
</Project>

dotnet-desktop-guide/net/winforms/controls-design/snippets/designer-properties-overview/vb/CompassRose.vb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Public Class CompassRose
1212

1313
'<browsable>
1414
<Browsable(False)>
15+
<DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
1516
Public Property IsSelected As Boolean
1617
'</browsable>
1718

Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0-windows</TargetFramework>
4+
<TargetFramework>net9.0-windows</TargetFramework>
65
<StartupObject>Sub Main</StartupObject>
76
<UseWindowsForms>true</UseWindowsForms>
87
<MyType>WindowsForms</MyType>
98
<RootNamespace>UserControlProject</RootNamespace>
109
</PropertyGroup>
11-
1210
<ItemGroup>
1311
<Import Include="System.Data" />
1412
<Import Include="System.Drawing" />
1513
<Import Include="System.Windows.Forms" />
1614
</ItemGroup>
17-
1815
<ItemGroup>
1916
<Compile Update="My Project\Application.Designer.vb">
2017
<DesignTime>True</DesignTime>
2118
<AutoGen>True</AutoGen>
2219
<DependentUpon>Application.myapp</DependentUpon>
2320
</Compile>
2421
</ItemGroup>
25-
2622
<ItemGroup>
2723
<None Update="My Project\Application.myapp">
2824
<Generator>MyApplicationCodeGenerator</Generator>
2925
<LastGenOutput>Application.Designer.vb</LastGenOutput>
3026
</None>
3127
</ItemGroup>
32-
3328
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows</TargetFramework>
4+
<TargetFramework>net9.0-windows</TargetFramework>
65
<Nullable>enable</Nullable>
76
<UseWindowsForms>true</UseWindowsForms>
87
<ImplicitUsings>enable</ImplicitUsings>
98
</PropertyGroup>
10-
119
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows</TargetFramework>
4+
<TargetFramework>net9.0-windows</TargetFramework>
65
<StartupObject>Sub Main</StartupObject>
76
<UseWindowsForms>true</UseWindowsForms>
87
<MyType>WindowsForms</MyType>
98
<RootNamespace>CustomControlProject</RootNamespace>
109
</PropertyGroup>
11-
1210
<ItemGroup>
1311
<Import Include="System.Data" />
1412
<Import Include="System.Drawing" />
1513
<Import Include="System.Windows.Forms" />
1614
</ItemGroup>
17-
1815
<ItemGroup>
1916
<Compile Update="My Project\Application.Designer.vb">
2017
<DesignTime>True</DesignTime>
2118
<AutoGen>True</AutoGen>
2219
<DependentUpon>Application.myapp</DependentUpon>
2320
</Compile>
2421
</ItemGroup>
25-
2622
<ItemGroup>
2723
<None Update="My Project\Application.myapp">
2824
<Generator>MyApplicationCodeGenerator</Generator>
2925
<LastGenOutput>Application.Designer.vb</LastGenOutput>
3026
</None>
3127
</ItemGroup>
32-
3328
</Project>

dotnet-desktop-guide/net/winforms/controls-design/snippets/how-to-create-simple-custom-control/vb/DefaultTemplate/FirstControl.vb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Namespace DefaultTemplate
1+
Imports System.ComponentModel
2+
3+
Namespace DefaultTemplate
24

35
' <template>
46
Public Class FirstControl
@@ -15,6 +17,8 @@
1517
Public Class SomethingElse : Inherits System.Windows.Forms.Control
1618
Private _textAlignment As HorizontalAlignment = HorizontalAlignment.Left
1719

20+
21+
#Disable Warning WFO1000 ' Missing code serialization configuration for property content
1822
' <property>
1923
Public Property TextAlignment As HorizontalAlignment
2024
Get
@@ -27,6 +31,7 @@
2731
End Set
2832
End Property
2933
' </property>
34+
#Enable Warning WFO1000 ' Missing code serialization configuration for property content
3035
End Class
3136

3237
End Namespace
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0-windows</TargetFramework>
4+
<TargetFramework>net9.0-windows</TargetFramework>
65
<StartupObject>Sub Main</StartupObject>
76
<UseWindowsForms>true</UseWindowsForms>
87
<MyType>WindowsForms</MyType>
98
<RootNamespace>UserControlProject</RootNamespace>
109
</PropertyGroup>
11-
1210
<ItemGroup>
1311
<Import Include="System.Data" />
1412
<Import Include="System.Drawing" />
1513
<Import Include="System.Windows.Forms" />
1614
</ItemGroup>
17-
1815
<ItemGroup>
1916
<Compile Update="My Project\Application.Designer.vb">
2017
<DesignTime>True</DesignTime>
2118
<AutoGen>True</AutoGen>
2219
<DependentUpon>Application.myapp</DependentUpon>
2320
</Compile>
2421
</ItemGroup>
25-
2622
<ItemGroup>
2723
<None Update="My Project\Application.myapp">
2824
<Generator>MyApplicationCodeGenerator</Generator>
2925
<LastGenOutput>Application.Designer.vb</LastGenOutput>
3026
</None>
3127
</ItemGroup>
32-
3328
</Project>

dotnet-desktop-guide/net/winforms/controls-design/snippets/how-to-create-usercontrol/csharp/ClearableTextBox.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public partial class ClearableTextBox : UserControl
1818

1919
//<text>
2020
[Browsable(true)]
21+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
2122
public new string Text
2223
{
2324
get => txtValue.Text;
@@ -27,6 +28,7 @@ public partial class ClearableTextBox : UserControl
2728

2829
//<title>
2930
[Browsable(true)]
31+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
3032
public string Title
3133
{
3234
get => lblTitle.Text;
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net7.0-windows</TargetFramework>
4+
<TargetFramework>net9.0-windows</TargetFramework>
65
<Nullable>enable</Nullable>
76
<UseWindowsForms>true</UseWindowsForms>
87
<ImplicitUsings>enable</ImplicitUsings>
98
</PropertyGroup>
10-
119
</Project>

dotnet-desktop-guide/net/winforms/controls-design/snippets/how-to-create-usercontrol/vb/ClearableTextBox.vb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Public Class ClearableTextBox
2121

2222
'<text>
2323
<Browsable(True)>
24+
<DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)>
2425
Public Shadows Property Text() As String
2526
Get
2627
Return txtValue.Text
@@ -33,6 +34,7 @@ Public Class ClearableTextBox
3334

3435
'<title>
3536
<Browsable(True)>
37+
<DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)>
3638
Public Property Title() As String
3739
Get
3840
Return lblTitle.Text

0 commit comments

Comments
 (0)