本文档已存档,并且将不进行维护。

Control.Padding 属性

Gets or sets the padding inside a control.

命名空间: System.Windows.Controls
程序集: PresentationFramework(在 presentationframework.dll 中)
XML 命名空间:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(true)] 
public Thickness Padding { get; set; }
/** @property */
public Thickness get_Padding ()

/** @property */
public void set_Padding (Thickness value)

public function get Padding () : Thickness

public function set Padding (value : Thickness)

<object>
  <object.Padding>
    <Thickness .../>
  </object.Padding>
</object>
<object Padding="Thickness" .../>

属性值

A Thickness. The default value is zero (0).

Padding is the amount of space to insert between the object and its Margin or Border. Padding is specified in the order Left, Top, Right, and Bottom. For more information, see Thickness.

The following example shows how to set the padding property of a control.

<Button Name="btn11" Padding = "5" 
        Click="ChangePadding" TabIndex="1">
  Padding
</Button>

if (btn11.Padding.Left == 5.0)
{
    btn11.Padding = new Thickness(2.0);
    btn11.Content = "Padding";

}
else
{
    btn11.Padding = new Thickness(5.0);
    btn11.Content = "Control Padding changes from 5 to 2.";
}

Windows Vista、Microsoft Windows XP SP2 和 Windows Server 2003 SP1 支持 Microsoft .NET Framework 3.0。

.NET Framework

受以下版本支持:3.0
显示: