| title | ms.custom | ms.date | ms.prod | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
How to: Create a Border Around a Windows Forms Control Using Padding |
03/30/2017 |
.net-framework |
|
article |
|
|
bac7ed4d-a163-4259-98bd-155a36345890 |
5 |
dotnet-bot |
dotnetcontent |
wpickett |
How to: Create a Border Around a Windows Forms Control Using Padding
The following code example demonstrates how to create a border or outline around a xref:System.Windows.Forms.RichTextBox control. The example sets the value of a xref:System.Windows.Forms.Panel control’s xref:System.Windows.Forms.Padding property to 5 and sets the xref:System.Windows.Forms.Control.Dock%2A property of a child xref:System.Windows.Forms.RichTextBox control to xref:System.Windows.Forms.DockStyle.Fill. The xref:System.Windows.Forms.Control.BackColor%2A of the xref:System.Windows.Forms.Panel control is set to xref:System.Drawing.Color.Blue%2A, which creates a blue border around the xref:System.Windows.Forms.RichTextBox control.
Example
[!code-csharpSystem.Windows.Forms.Padding#1] [!code-vbSystem.Windows.Forms.Padding#1]
See Also
xref:System.Windows.Forms.Padding
Margin and Padding in Windows Forms Controls