ScrollableControl::DockPadding Property
Gets the dock padding settings for all edges of the control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
[BrowsableAttribute(false)] public: property ScrollableControl..::..DockPaddingEdges^ DockPadding { ScrollableControl..::..DockPaddingEdges^ get (); }
Property Value
Type: System.Windows.Forms::ScrollableControl::DockPaddingEdgesA ScrollableControl::DockPaddingEdges that represents the padding for all the edges of a docked control.
The following code example uses the derived class, Panel. The example docks a button in a panel control and cycles through the ScrollableControl::DockPaddingEdges properties, setting each individually on the click of the button. The example requires that you have created an instance of a Panel control and a Button on a form, and you have declared a class level member variable named myCounter as a 32-bit signed integer. You should call this code on the Click event of the button.
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++; }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.