vb.net做控件属性 vb控件属性值怎么打开( 三 )


RadioButton TabIndex =
RadioButton Text = 三单元
RadioButton
RadioButton Location = New System Drawing Point( )
RadioButton Name = RadioButton
RadioButton Size = New System Drawing Size( )
RadioButton TabIndex =
RadioButton Text = 一单元
RadioButton
RadioButton BackColor = System Drawing SystemColors Control
RadioButton Location = New System Drawing Point( )
RadioButton Name = RadioButton
RadioButton Size = New System Drawing Size( )
RadioButton TabIndex =
RadioButton Text = 四单元
RadioButton
RadioButton Location = New System Drawing Point( )
RadioButton Name = RadioButton
RadioButton Size = New System Drawing Size( )
RadioButton TabIndex =
RadioButton Text = 二楼
RadioButton
RadioButton Location = New System Drawing Point( )
RadioButton Name = RadioButton
RadioButton Size = New System Drawing Size( )
RadioButton TabIndex =
RadioButton Text = 三楼
RadioButton
【vb.net做控件属性 vb控件属性值怎么打开】 RadioButton Location = New System Drawing Point( )
RadioButton Name = RadioButton
RadioButton Size = New System Drawing Size( )
RadioButton TabIndex =
RadioButton Text = 一楼
RadioButton
RadioButton BackColor = System Drawing SystemColors Control
RadioButton Location = New System Drawing Point( )
RadioButton Name = RadioButton
RadioButton Size = New System Drawing Size( )
RadioButton TabIndex =
RadioButton Text = 四楼
分别把它们添加到父控件GroupBox的Controls集合中
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
GroupBox Controls Add(RadioButton )
End Sub
把上一页的代码复制添加后 把控件初始化过程InitializeControl()过程添加到Form 的New构造函数中 如下图二所示
图二 在New构造函数中添加过程InitializeControl()
现在按F 运行 Form 的窗体控件布局(如下图三所示)是不是和我们手工布局的图一的布局是一样的呢?
lishixinzhi/Article/program/ASP/201311/21749
VB.NET 动态控件 属性问题布局方面,建议你用FlowLayoutPanel,不用手工控制控件位置了 。假设有一个FlowLayoutPanel1 。
先在窗体类中建一个控件的集合:
Dim
TextBoxes
As
New
List(Of
TextBox)
在button1的
Click事件
中写:
For
i
=
1
To
5
'5是每次加入的数量
Dim
newTextBox
As
New
TextBox()
'newTextBox.Size
=
New
Size(100,20)
'
TextBoxes.Add(newTextBox)
'加入我们的集合中
FlowLayoutPanel1.Controls.Add(newTextBox)
'加到窗体的FlowLayoutPanel中去
Next
i
然后button2的Click事件中:
For
Each
itemTextBox
As
TextBox
In
TextBoxes
'这里的itemTextBox.Text就代表每个TextBox里的文本
'如果你需要清空,调用TextBoxes.Clear()和FlowLayoutPanel.Controls.Clear()即可
Next
如何声明控件属性 vb.netPublic Class ControlValue
Inherits Control
''' summary
''' 获取或设置控件的值 。
''' /summary
System.ComponentModel.Browsable(True)
System.ComponentModel.Category("布局")
System.ComponentModel.Description("获取或设置控件的值 。")

推荐阅读