Merge branch 'master' into publish-12373

This commit is contained in:
CXWTool Service Account
2021-01-28 07:01:09 +00:00
40 changed files with 62 additions and 137 deletions
@@ -7,9 +7,6 @@ helpviewer_keywords:
- "ElementHost control [Windows Forms], copying and pasting at design time"
- "WPF user control [Windows Forms], hosting in Windows Forms"
ms.assetid: e570375d-2a68-44ba-b4f7-c781af2d20e8
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Copy and paste an ElementHost control
@@ -5,9 +5,6 @@ helpviewer_keywords:
- "Windows Forms Designer [Windows Forms], interoperability with WPF"
- "interoperability [WPF]"
ms.assetid: 03c85dce-26ad-44cd-bc1d-8e0cb56de096
author: jillre
ms.author: jillfra
manager: jillfra
---
# Use WPF controls in Windows Forms apps
@@ -10,9 +10,6 @@ helpviewer_keywords:
- "Windows Forms, anchoring and docking WPF content"
- "interoperability [WPF]"
ms.assetid: 5efb1c53-1484-43d6-aa8a-f4861b99bb8a
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Arrange WPF content on Windows Forms at design time
@@ -9,9 +9,6 @@ helpviewer_keywords:
- "Windows Forms, content assignments"
- "WPF user control [Windows Forms], hosting in Windows Forms"
ms.assetid: b3e9ef93-7e0f-4a2f-8f1e-3437609a1eb7
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Assign WPF content on Windows Forms at design time
@@ -9,9 +9,6 @@ helpviewer_keywords:
- "ElementHost control"
- "WPF user control [Windows Forms], hosting in Windows Forms"
ms.assetid: 2e92d8e8-f0e4-4df7-9f07-2acf35cd798c
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Create new WPF content on Windows Forms at design time
@@ -6,9 +6,6 @@ helpviewer_keywords:
- "interoperability [WDF]"
- "styles [Windows Forms], WPF content"
ms.assetid: e574aac7-7ea4-4cdb-8034-bab541f000df
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Style WPF content
@@ -11,9 +11,6 @@ helpviewer_keywords:
- "DocumentDesigner class [Windows Forms]"
- "walkthroughs [Windows Forms], controls"
ms.assetid: 6f487c59-cb38-4afa-ad2e-95edacb1d626
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Create a control that takes advantage of design-time features
@@ -10,9 +10,6 @@ helpviewer_keywords:
- "errors [Windows Forms Designer]"
- "design-time errors [Windows Forms Designer]"
ms.assetid: ad408380-825a-46d8-9a4a-531b130b88ce
author: jillre
ms.author: jillfra
manager: jillfra
---
# Windows Forms Designer error page
@@ -9,9 +9,6 @@ helpviewer_keywords:
- "user controls [Windows Forms]"
- "custom controls [Windows Forms]"
ms.assetid: e5a8e088-7ec8-4fd9-bcb3-9078fd134829
author: jillre
ms.author: jillfra
manager: jillfra
---
# Develop Windows Forms controls at design time
@@ -9,9 +9,6 @@ helpviewer_keywords:
- "controls [Windows Forms], positioning"
- "controls [Windows Forms], aligning"
ms.assetid: b7175656-f532-49e9-b0b1-177d1b40af3e
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Align Multiple Controls on Windows Forms
@@ -12,9 +12,6 @@ helpviewer_keywords:
- "Windows Forms, resizing"
- "controls [Windows Forms], positioning"
ms.assetid: 59ea914f-fbd3-427a-80fe-decd02f7ae6d
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Anchor controls on Windows Forms
@@ -7,9 +7,6 @@ helpviewer_keywords:
- "user controls [Windows Forms], inheriting from"
- "composite controls [Windows Forms], creating"
ms.assetid: 79c9cf05-5ab6-4a18-886d-88a64748b098
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Author composite controls
@@ -6,9 +6,6 @@ helpviewer_keywords:
- "UserControl class [Windows Forms], Windows Forms"
- "custom controls [Windows Forms], creating"
ms.assetid: 7570e982-545b-4c3a-a7c7-55581d313400
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Author controls for Windows Forms
@@ -8,9 +8,6 @@ helpviewer_keywords:
- "assembly folder registration [Windows Forms], Choose Toolbox Items dialog box"
- "Choose Toolbox Items dialog box [Windows Forms], display control"
ms.assetid: 01ef6eba-d044-40f0-951d-78eff7ebd9a9
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Display a Control in the Choose Toolbox Items Dialog Box
@@ -6,9 +6,6 @@ helpviewer_keywords:
- "Explorer-style applications [Windows Forms], creating"
- "Windows Forms controls, filling client area"
ms.assetid: bc11f2e4-e90a-4830-b0e2-f43b6e2b8bec
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Dock controls on Windows Forms
@@ -8,9 +8,6 @@ helpviewer_keywords:
- "inheritance [Windows Forms], Windows Forms custom controls"
- "custom controls [Windows Forms], inheritance"
ms.assetid: 1e1fc8ea-c615-4cf0-a356-16d6df7444ab
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Inherit from Existing Windows Forms Controls
@@ -8,9 +8,6 @@ helpviewer_keywords:
- "OnPaint method [Windows Forms]"
- "custom controls [Windows Forms], creating"
ms.assetid: 46ba0df3-5cf7-443c-a3b4-a72660172476
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Inherit from the Control Class
@@ -7,9 +7,6 @@ helpviewer_keywords:
- "user controls [Windows Forms], creating"
- "composite controls [Windows Forms], creating"
ms.assetid: 67713625-e2e4-4f6a-bce7-0855ee5043d9
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Inherit from the UserControl Class
@@ -13,9 +13,6 @@ helpviewer_keywords:
- "controls [Windows Forms], positioning"
- "z-order"
ms.assetid: 1acc4281-2976-4715-86f4-bda68134baaf
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Layer objects on Windows Forms
@@ -5,9 +5,6 @@ helpviewer_keywords:
- "Windows Forms controls, locking"
- "controls [Windows Forms], locking"
ms.assetid: 94efe0d2-c14e-4d14-b903-63ea9b07e290
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Lock controls to Windows Forms
@@ -16,9 +16,6 @@ helpviewer_keywords:
- "snaplines"
- "controls [Windows Forms], positioning"
ms.assetid: 4693977e-34a4-4f19-8221-68c3120c2b2b
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Position controls on Windows Forms
@@ -9,9 +9,6 @@ helpviewer_keywords:
- "custom controls [Windows Forms], Toolbox bitmaps"
- "bitmaps [Windows Forms], custom controls"
ms.assetid: 0ed0840a-616d-41ba-a27d-3573241932ad
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Provide a Toolbox Bitmap for a Control
@@ -6,9 +6,6 @@ helpviewer_keywords:
- "layout [Windows Forms], resizing"
- "layout [Windows Forms], child controls"
ms.assetid: 5a5723ff-34e0-4b6f-a57b-be4ebe35cb34
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Reassign existing controls to a different parent
@@ -9,9 +9,6 @@ helpviewer_keywords:
- "size [Windows Forms], controls"
- "Windows Forms controls, size"
ms.assetid: d2dba441-a8c0-4705-b8e8-2e5d86d6e7ec
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Resize controls on Windows Forms
@@ -8,9 +8,6 @@ helpviewer_keywords:
- "Windows Forms, grid options in designer"
- "Windows Forms Designer"
ms.assetid: 36967466-1dfd-4fae-a7f1-7bf2cbc94048
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Set grid options for all Windows Forms
@@ -11,9 +11,6 @@ helpviewer_keywords:
- "controls [Windows Forms], setting tab order"
- "Windows Forms, setting tab order"
ms.assetid: 71fa8e76-0472-414b-ad3c-0f90166e0ad7
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Set the tab order on Windows Forms
@@ -8,9 +8,6 @@ helpviewer_keywords:
- "UserControl Test Container"
- "UserControl class [Windows Forms], run-time behavior"
ms.assetid: 4e4d5c49-1346-40ac-9d96-40211b573583
author: jillre
ms.author: jillfra
manager: jillfra
---
# How to: Test the run-time behavior of a UserControl
@@ -38,19 +38,14 @@ The <xref:System.Windows.Forms.WebBrowser> control lets you implement two-way co
[!code-csharp[System.Windows.Forms.WebBrowser.ObjectForScripting#3](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser.ObjectForScripting/CS/form1.cs#3)]
[!code-vb[System.Windows.Forms.WebBrowser.ObjectForScripting#3](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser.ObjectForScripting/vb/form1.vb#3)]
4. Set the <xref:System.Windows.Forms.WebBrowser.ObjectForScripting%2A> property in the form's constructor or a <xref:System.Windows.Forms.Form.Load> event handler.
4. Set the <xref:System.Windows.Forms.WebBrowser.ObjectForScripting%2A> property in the form's constructor or override the <xref:System.Windows.Forms.Form.OnLoad%2A> method.
The following code uses the form class itself for the scripting object.
> [!NOTE]
> Component Object Model (COM) must be able to access the scripting object. To make your form visible to COM, add the <xref:System.Runtime.InteropServices.ComVisibleAttribute> attribute to your form class.
[!code-csharp[System.Windows.Forms.WebBrowser.ObjectForScripting#4](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser.ObjectForScripting/CS/form1.cs#4)]
[!code-vb[System.Windows.Forms.WebBrowser.ObjectForScripting#4](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser.ObjectForScripting/vb/form1.vb#4)]
5. Implement public properties or methods in your application code that your script code will use.
For example, if you use the form class for the scripting object, add the following code to your form class.
5. Implement your scripting object.
[!code-csharp[System.Windows.Forms.WebBrowser.ObjectForScripting#5](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser.ObjectForScripting/CS/form1.cs#5)]
[!code-vb[System.Windows.Forms.WebBrowser.ObjectForScripting#5](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser.ObjectForScripting/vb/form1.vb#5)]
@@ -4,9 +4,6 @@ ms.date: "02/13/2019"
helpviewer_keywords:
- "designer actions"
ms.assetid: cac337e6-00f6-4584-80f4-75728f5ea113
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Perform common tasks using designer actions
@@ -11,9 +11,6 @@ helpviewer_keywords:
- "collections [Windows Forms], serializing"
- "collections [Windows Forms], standard types"
ms.assetid: 020c9df4-fdc5-4dae-815a-963ecae5668c
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Serialize collections of standard types
@@ -11,9 +11,6 @@ helpviewer_keywords:
- "components [Windows Forms], troubleshooting"
- "Windows Forms controls, debugging"
ms.assetid: e9c8c099-2271-4737-882f-50f336c7a55e
author: jillre
ms.author: jillfra
manager: jillfra
---
# Troubleshoot Control and Component Authoring
@@ -7,9 +7,6 @@ helpviewer_keywords:
- "SnapLine class [Windows Forms], walkthroughs"
- "Windows Forms controls, arranging"
ms.assetid: d5c9edc7-cf30-4a97-8ebe-201d569340f8
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Arrange controls on Windows Forms using snaplines
@@ -10,9 +10,6 @@ helpviewer_keywords:
- "user controls [C#]"
- "custom controls [Windows Forms], creating"
ms.assetid: f88481a8-c746-4a36-9479-374ce5f2e91f
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Author a Composite Control with C\#
@@ -15,9 +15,6 @@ helpviewer_keywords:
- "walkthroughs [Windows Forms], debugging"
- "design-time debugging"
ms.assetid: 1fd83ccd-3798-42fc-85a3-6cba99467387
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Debug Custom Windows Forms Controls at Design Time
@@ -8,9 +8,6 @@ helpviewer_keywords:
- "inheritance [Windows Forms], walkthroughs"
- "custom controls [Windows Forms], inheritance"
ms.assetid: 09476da0-8d4c-4a4c-b969-649519dfb438
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Inherit from a Windows Forms Control with C\#
@@ -15,9 +15,6 @@ helpviewer_keywords:
- "layout [Windows Forms], margins and padding"
- "Windows Forms, layout"
ms.assetid: f8ae2a6b-db13-4630-8e25-d104091205c7
author: jillre
ms.author: jillfra
manager: jillfra
---
# Walkthrough: Lay out controls with padding, margins, and the AutoSize property
@@ -1,10 +1,7 @@
//<snippet0>
using System;
using System.Windows.Forms;
using System.Security.Permissions;
[PermissionSet(SecurityAction.Demand, Name="FullTrust")]
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public class Form1 : Form
{
private WebBrowser webBrowser1 = new WebBrowser();
@@ -25,11 +22,12 @@ public class Form1 : Form
webBrowser1.Dock = DockStyle.Fill;
Controls.Add(webBrowser1);
Controls.Add(button1);
Load += new EventHandler(Form1_Load);
}
private void Form1_Load(object sender, EventArgs e)
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
//<snippet1>
webBrowser1.AllowWebBrowserDrop = false;
//</snippet1>
@@ -40,7 +38,7 @@ public class Form1 : Form
webBrowser1.WebBrowserShortcutsEnabled = false;
//</snippet3>
//<snippet4>
webBrowser1.ObjectForScripting = this;
webBrowser1.ObjectForScripting = new MyScriptObject(this);
//</snippet4>
//<snippet9>
// Uncomment the following line when you are finished debugging.
@@ -56,13 +54,6 @@ public class Form1 : Form
"</body></html>";
}
//<snippet5>
public void Test(String message)
{
MessageBox.Show(message, "client code");
}
//</snippet5>
private void button1_Click(object sender, EventArgs e)
{
//<snippet8>
@@ -71,4 +62,21 @@ public class Form1 : Form
//</snippet8>
}
}
//<snippet5>
public class MyScriptObject
{
private Form1 _form;
public MyScriptObject(Form1 form)
{
_form = form;
}
public void Test(string message)
{
MessageBox.Show(message, "client code");
}
}
//</snippet5>
//</snippet0>
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net472;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
</Project>
@@ -1,9 +1,6 @@
'<snippet0>
Imports System.Windows.Forms
Imports System.Security.Permissions
<PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _
<System.Runtime.InteropServices.ComVisibleAttribute(True)> _
Public Class Form1
Inherits Form
@@ -24,8 +21,8 @@ Public Class Form1
Controls.Add(button1)
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles Me.Load
Protected Overrides Sub OnLoad(e As EventArgs)
MyBase.OnLoad(e)
'<snippet1>
webBrowser1.AllowWebBrowserDrop = False
@@ -37,7 +34,7 @@ Public Class Form1
webBrowser1.WebBrowserShortcutsEnabled = False
'</snippet3>
'<snippet4>
webBrowser1.ObjectForScripting = Me
webBrowser1.ObjectForScripting = New MyScriptObject(Me)
'</snippet4>
'<snippet9>
' Uncomment the following line when you are finished debugging.
@@ -53,12 +50,6 @@ Public Class Form1
"</body></html>"
End Sub
'<snippet5>
Public Sub Test(ByVal message As String)
MessageBox.Show(message, "client code")
End Sub
'</snippet5>
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) _
Handles button1.Click
@@ -70,4 +61,19 @@ Public Class Form1
End Sub
End Class
'<snippet5>
Public Class MyScriptObject
Private _form As Form1
Public Sub New(ByVal form As Form1)
_form = form
End Sub
Public Sub Test(ByVal message As String)
MessageBox.Show(message, "client code")
End Sub
End Class
'</snippet5>
'</snippet0>
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net472;net5.0-windows</TargetFrameworks>
<RootNamespace>sample</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
<MyType>WindowsForms</MyType>
<StartupObject>sample.Form1</StartupObject>
</PropertyGroup>
</Project>