ScrollableControl.DockPadding プロパティ

定義

コントロールのすべての端に対するドッキング埋め込みの設定を取得します。

C#
public System.Windows.Forms.ScrollableControl.DockPaddingEdges DockPadding { get; }
C#
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.ScrollableControl.DockPaddingEdges DockPadding { get; }

プロパティ値

ドッキングされているコントロールのすべての端の埋め込みを表す ScrollableControl.DockPaddingEdges

属性

次のコード例では、 Panel派生クラス を使用します。 この例では、パネル コントロールにボタンをドッキングし、プロパティを順番に ScrollableControl.DockPaddingEdges 切り上げ、各ボタンをクリックして個別に設定します。 この例では、フォーム上に コントロールと ButtonPanelインスタンスを作成し、32 ビット符号付き整数として という名前myCounterのクラス レベルのメンバー変数を宣言している必要があります。 ボタンの イベントでこのコードを Click 呼び出す必要があります。

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;
 }

注釈

このプロパティは、ドッキングされたコンポーネントのこのコントロール内の境界線を制御します。

適用対象

製品 バージョン
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

こちらもご覧ください