SplitContainer.Panel1MinSize 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置拆分器与 Panel1 的左边缘或上边缘的最小距离(以像素为单位)。
public:
property int Panel1MinSize { int get(); void set(int value); };
public int Panel1MinSize { get; set; }
member this.Panel1MinSize : int with get, set
Public Property Panel1MinSize As Integer
属性值
Int32,它表示拆分器离 Panel1 的左边缘或上边缘的最小距离(以像素为单位)。 不管 Orientation 为何值,默认值均为 25 像素。
例外
指定的值与方向不一致。
示例
下面的代码示例显示了垂直拆分器,其中左面板 (最小大小的 Panel1) 设置为 30 像素,现在拆分器可以从容器的左边缘最小距离。 还显示了垂直拆分器的其他基本属性。 此示例是为类提供的大型示例的 SplitContainer 一部分。
// Basic SplitContainer properties.
// This is a vertical splitter that moves in 10-pixel increments.
// This splitter needs no explicit Orientation property because Vertical is the default.
splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
splitContainer1->ForeColor = System::Drawing::SystemColors::Control;
splitContainer1->Location = System::Drawing::Point( 0, 0 );
splitContainer1->Name = "splitContainer1";
// You can drag the splitter no nearer than 30 pixels from the left edge of the container.
splitContainer1->Panel1MinSize = 30;
// You can drag the splitter no nearer than 20 pixels from the right edge of the container.
splitContainer1->Panel2MinSize = 20;
splitContainer1->Size = System::Drawing::Size( 292, 273 );
splitContainer1->SplitterDistance = 79;
// This splitter moves in 10-pixel increments.
splitContainer1->SplitterIncrement = 10;
splitContainer1->SplitterWidth = 6;
// splitContainer1 is the first control in the tab order.
splitContainer1->TabIndex = 0;
splitContainer1->Text = "splitContainer1";
// When the splitter moves, the cursor changes shape.
splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler( this, &Form1::splitContainer1_SplitterMoved );
splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler( this, &Form1::splitContainer1_SplitterMoving );
// Add a TreeView control to the left panel.
splitContainer1->Panel1->BackColor = System::Drawing::SystemColors::Control;
// Add a TreeView control to Panel1.
splitContainer1->Panel1->Controls->Add( treeView1 );
splitContainer1->Panel1->Name = "splitterPanel1";
// Controls placed on Panel1 support right-to-left fonts.
splitContainer1->Panel1->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
// Basic SplitContainer properties.
// This is a vertical splitter that moves in 10-pixel increments.
// This splitter needs no explicit Orientation property because Vertical is the default.
splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
splitContainer1.ForeColor = System.Drawing.SystemColors.Control;
splitContainer1.Location = new System.Drawing.Point(0, 0);
splitContainer1.Name = "splitContainer1";
// You can drag the splitter no nearer than 30 pixels from the left edge of the container.
splitContainer1.Panel1MinSize = 30;
// You can drag the splitter no nearer than 20 pixels from the right edge of the container.
splitContainer1.Panel2MinSize = 20;
splitContainer1.Size = new System.Drawing.Size(292, 273);
splitContainer1.SplitterDistance = 79;
// This splitter moves in 10-pixel increments.
splitContainer1.SplitterIncrement = 10;
splitContainer1.SplitterWidth = 6;
// splitContainer1 is the first control in the tab order.
splitContainer1.TabIndex = 0;
splitContainer1.Text = "splitContainer1";
// When the splitter moves, the cursor changes shape.
splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(splitContainer1_SplitterMoved);
splitContainer1.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(splitContainer1_SplitterMoving);
// Add a TreeView control to the left panel.
splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control;
// Add a TreeView control to Panel1.
splitContainer1.Panel1.Controls.Add(treeView1);
splitContainer1.Panel1.Name = "splitterPanel1";
// Controls placed on Panel1 support right-to-left fonts.
splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
' Basic SplitContainer properties.
' This is a vertical splitter that moves in 10-pixel increments.
' This splitter needs no explicit Orientation property because Vertical is the default.
splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
splitContainer1.ForeColor = System.Drawing.SystemColors.Control
splitContainer1.Location = New System.Drawing.Point(0, 0)
splitContainer1.Name = "splitContainer1"
' You can drag the splitter no nearer than 30 pixels from the left edge of the container.
splitContainer1.Panel1MinSize = 30
' You can drag the splitter no nearer than 20 pixels from the right edge of the container.
splitContainer1.Panel2MinSize = 20
splitContainer1.Size = New System.Drawing.Size(292, 273)
splitContainer1.SplitterDistance = 79
' This splitter moves in 10-pixel increments.
splitContainer1.SplitterIncrement = 10
splitContainer1.SplitterWidth = 6
' splitContainer1 is the first control in the tab order.
splitContainer1.TabIndex = 0
splitContainer1.Text = "splitContainer1"
' Add a TreeView control to the left panel.
splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control
' Add a TreeView control to Panel1.
splitContainer1.Panel1.Controls.Add(treeView1)
splitContainer1.Panel1.Name = "splitterPanel1"
' Controls placed on Panel1 support right-to-left fonts.
splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes
注解
使用该 Panel1MinSize 属性可防止拆分器太接近容器的左边缘或上边缘移动。 例如,你可能想要阻止覆盖部分 TreeView 显示区域。
Orientation如果属性Vertical
(默认) ,Panel1MinSize则从左边缘Panel1返回拆分器的最低距离(以像素为单位)。 如果属性是OrientationHorizontal
,Panel1MinSize则返回从上边缘Panel1的拆分器最小距离(以像素为单位)。