次の方法で共有


ScrollableControl.DockPaddingEdges.Left プロパティ

ドッキングされたコントロールの左端の埋め込み幅を取得または設定します。

Public Property Left As Integer
[C#]
public int Left {get; set;}
[C++]
public: __property int get_Left();public: __property void set_Left(int);
[JScript]
public function get Left() : int;public function set Left(int);

プロパティ値

埋め込みの幅 (ピクセル単位)。

解説

このプロパティに割り当てられた埋め込み幅は、ドッキングされたコントロールの左端のみに適用されます。

使用例

[Visual Basic, C#, C++] 派生クラス Panel を使用する例を次に示します。この例では、パネル コントロールにボタンをドッキングし、 ScrollableControl.DockPaddingEdges プロパティをとおして循環処理し、ボタンのクリックについてそれぞれ設定します。このコードは、 Panel コントロールと Button がフォーム上でインスタンス化されていること、および myCounter という名前のクラス レベルのメンバ変数が 32 ビットの符号付き整数として宣言されていることを前提にしています。このコードは、ボタンの Click イベントが発生すると呼び出されます。

 
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


[C#] 
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;
 }
 

[C++] 
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 = S"Start";
          break;
       case 1:
          panel1->DockPadding->Top = 10;
          button1->Text = S"Top";
          break;
       case 2:
          panel1->DockPadding->Bottom = 10;
          button1->Text = S"Bottom";
          break;
       case 3:
          panel1->DockPadding->Left = 10;
          button1->Text = S"Left";
          break;
       case 4:
          panel1->DockPadding->Right = 10;
          button1->Text = S"Right";
          break;
       case 5:
          panel1->DockPadding->All = 20;
          button1->Text = S"All";
          break;
    }

    myCounter++;
 }
 

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ScrollableControl.DockPaddingEdges クラス | ScrollableControl.DockPaddingEdges メンバ | System.Windows.Forms 名前空間 | All | Bottom | Top | Right