ScrollableControl.DockPaddingEdges.Right 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定停駐控制項右邊緣的填補寬度。
public:
property int Right { int get(); void set(int value); };
public int Right { get; set; }
member this.Right : int with get, set
Public Property Right As Integer
屬性值
以像素為單位的邊框距離寬度。
範例
下列程式碼範例使用衍生類別 。 Panel 此範例會將按鈕停駐在面板控制項中,並迴圈流覽 ScrollableControl.DockPaddingEdges 屬性,在每個按鈕按一下時個別設定。 此程式碼要求 Panel 控制項和 Button 已在表單上具現化,而名為 myCounter
的類別層級成員變數已宣告為 32 位帶正負號的整數。 此程式碼應該在 Click 按鈕的事件上呼叫。
void SetDockPadding()
{
// Dock the button in the panel.
button1->Dock = System::Windows::Forms::DockStyle::Fill;
// Reset the counter if it is greater than 5.
if ( myCounter > 5 )
{
myCounter = 0;
}
/* Set the appropriate DockPadding and display
which one was set on the button face. */
switch ( myCounter )
{
case 0:
panel1->DockPadding->All = 0;
button1->Text = "Start";
break;
case 1:
panel1->DockPadding->Top = 10;
button1->Text = "Top";
break;
case 2:
panel1->DockPadding->Bottom = 10;
button1->Text = "Bottom";
break;
case 3:
panel1->DockPadding->Left = 10;
button1->Text = "Left";
break;
case 4:
panel1->DockPadding->Right = 10;
button1->Text = "Right";
break;
case 5:
panel1->DockPadding->All = 20;
button1->Text = "All";
break;
}
myCounter++;
}
private void SetDockPadding()
{
// Dock the button in the panel.
button1.Dock = System.Windows.Forms.DockStyle.Fill;
// Reset the counter if it is greater than 5.
if (myCounter > 5)
{
myCounter = 0;
}
/* Set the appropriate DockPadding and display
which one was set on the button face. */
switch (myCounter)
{
case 0:
panel1.DockPadding.All = 0;
button1.Text = "Start";
break;
case 1:
panel1.DockPadding.Top = 10;
button1.Text = "Top";
break;
case 2:
panel1.DockPadding.Bottom = 10;
button1.Text = "Bottom";
break;
case 3:
panel1.DockPadding.Left = 10;
button1.Text = "Left";
break;
case 4:
panel1.DockPadding.Right = 10;
button1.Text = "Right";
break;
case 5:
panel1.DockPadding.All = 20;
button1.Text = "All";
break;
}
// Increment the counter.
myCounter += 1;
}
Private Sub SetDockPadding()
' Dock the button in the panel.
button1.Dock = System.Windows.Forms.DockStyle.Fill
' Reset the counter if it is greater than 5.
If myCounter > 5 Then
myCounter = 0
End If
' Set the appropriate DockPadding and display
' which one was set on the button face.
Select Case myCounter
Case 0
panel1.DockPadding.All = 0
button1.Text = "Start"
Case 1
panel1.DockPadding.Top = 10
button1.Text = "Top"
Case 2
panel1.DockPadding.Bottom = 10
button1.Text = "Bottom"
Case 3
panel1.DockPadding.Left = 10
button1.Text = "Left"
Case 4
panel1.DockPadding.Right = 10
button1.Text = "Right"
Case 5
panel1.DockPadding.All = 20
button1.Text = "All"
End Select
' Increment the counter.
myCounter += 1
End Sub
備註
指派給此屬性的填補寬度只會套用至停駐控制項的右邊緣。