groupbox文字居中_ASP_vb.net入门——分组控件:GroupBox控件的使用,我们对控件进行分组的原因不 - phpStudy...

Sub InitializeControl()

'首先添加Label和TextBox控件

Dim Label1 As New System.Windows.Forms.Label

Dim TextBox1 As New System.Windows.Forms.TextBox

'Label1

Label1.Location = New System.Drawing.Point(8, 8)

Label1.Name = "Label1"

Label1.Size = New System.Drawing.Size(64, 16)

Label1.TabIndex = 1

Label1.Text = "户主姓名"

'TextBox1

TextBox1.Location = New System.Drawing.Point(72, 7)

TextBox1.Name = "TextBox1"

TextBox1.Size = New System.Drawing.Size(128, 21)

TextBox1.TabIndex = 2

TextBox1.Text = ""

'把它们添加到父控件Form1的Controls集合中

Me.Controls.Add(TextBox1)

Me.Controls.Add(Label1)

'添加三个GroupBox控件

Dim GroupBox1 As New System.Windows.Forms.GroupBox

Dim GroupBox2 As New System.Windows.Forms.GroupBox

Dim GroupBox3 As New System.Windows.Forms.GroupBox

'GroupBox1

GroupBox1.BackColor = System.Drawing.SystemColors.Control

GroupBox1.Location = New System.Drawing.Point(8, 40)

GroupBox1.Name = "GroupBox1"

GroupBox1.Size = New System.Drawing.Size(96, 104)

GroupBox1.TabIndex = 3

GroupBox1.TabStop = False

GroupBox1.Text = "性别"

'GroupBox2

GroupBox2.Location = New System.Drawing.Point(103, 40)

GroupBox2.Name = "GroupBox2"

GroupBox2.Size = New System.Drawing.Size(96, 104)

GroupBox2.TabIndex = 4

GroupBox2.TabStop = False

GroupBox2.Text = "单元"

'GroupBox3

GroupBox3.Location = New System.Drawing.Point(197, 40)

GroupBox3.Name = "GroupBox3"

GroupBox3.Size = New System.Drawing.Size(96, 104)

GroupBox3.TabIndex = 5

GroupBox3.TabStop = False

GroupBox3.Text = "楼层"

'把它们添加到父控件Form1的Controls集合中

Me.Controls.Add(GroupBox1)

Me.Controls.Add(GroupBox2)

Me.Controls.Add(GroupBox3)

'添加RadioButton控件并分别绘制在GroupBox控件内

Dim RadioButton1 As New System.Windows.Forms.RadioButton

Dim RadioButton2 As New System.Windows.Forms.RadioButton

Dim RadioButton3 As New System.Windows.Forms.RadioButton

Dim RadioButton5 As New System.Windows.Forms.RadioButton

Dim RadioButton4 As New System.Windows.Forms.RadioButton

Dim RadioButton6 As New System.Windows.Forms.RadioButton

Dim RadioButton7 As New System.Windows.Forms.RadioButton

Dim RadioButton8 As New System.Windows.Forms.RadioButton

Dim RadioButton9 As New System.Windows.Forms.RadioButton

Dim RadioButton10 As New System.Windows.Forms.RadioButton

'RadioButton1

RadioButton1.Location = New System.Drawing.Point(8, 24)

RadioButton1.Name = "RadioButton1"

RadioButton1.Size = New System.Drawing.Size(80, 24)

RadioButton1.TabIndex = 0

RadioButton1.Text = "男性"

'RadioButton2

RadioButton2.Location = New System.Drawing.Point(8, 63)

RadioButton2.Name = "RadioButton2"

RadioButton2.Size = New System.Drawing.Size(80, 24)

RadioButton2.TabIndex = 1

RadioButton2.Text = "女性"

'RadioButton3

RadioButton3.Location = New System.Drawing.Point(8, 32)

RadioButton3.Name = "RadioButton3"

RadioButton3.Size = New System.Drawing.Size(80, 24)

RadioButton3.TabIndex = 1

RadioButton3.Text = "二单元"

'RadioButton5

RadioButton5.Location = New System.Drawing.Point(8, 53)

RadioButton5.Name = "RadioButton5"

RadioButton5.Size = New System.Drawing.Size(80, 24)

RadioButton5.TabIndex = 2

RadioButton5.Text = "三单元"

'RadioButton4

RadioButton4.Location = New System.Drawing.Point(8, 13)

RadioButton4.Name = "RadioButton4"

RadioButton4.Size = New System.Drawing.Size(80, 24)

RadioButton4.TabIndex = 0

RadioButton4.Text = "一单元"

'RadioButton6

RadioButton6.BackColor = System.Drawing.SystemColors.Control

RadioButton6.Location = New System.Drawing.Point(8, 75)

RadioButton6.Name = "RadioButton6"

RadioButton6.Size = New System.Drawing.Size(80, 24)

RadioButton6.TabIndex = 3

RadioButton6.Text = "四单元"

'RadioButton7

RadioButton7.Location = New System.Drawing.Point(8, 32)

RadioButton7.Name = "RadioButton7"

RadioButton7.Size = New System.Drawing.Size(80, 24)

RadioButton7.TabIndex = 1

RadioButton7.Text = "二楼"

'RadioButton8

RadioButton8.Location = New System.Drawing.Point(8, 53)

RadioButton8.Name = "RadioButton8"

RadioButton8.Size = New System.Drawing.Size(80, 24)

RadioButton8.TabIndex = 2

RadioButton8.Text = "三楼"

'RadioButton9

RadioButton9.Location = New System.Drawing.Point(8, 13)

RadioButton9.Name = "RadioButton9"

RadioButton9.Size = New System.Drawing.Size(80, 24)

RadioButton9.TabIndex = 0

RadioButton9.Text = "一楼"

'RadioButton10

RadioButton10.BackColor = System.Drawing.SystemColors.Control

RadioButton10.Location = New System.Drawing.Point(8, 75)

RadioButton10.Name = "RadioButton10"

RadioButton10.Size = New System.Drawing.Size(80, 24)

RadioButton10.TabIndex = 3

RadioButton10.Text = "四楼"

'分别把它们添加到父控件GroupBox的Controls集合中

GroupBox1.Controls.Add(RadioButton1)

GroupBox1.Controls.Add(RadioButton2)

GroupBox2.Controls.Add(RadioButton3)

GroupBox2.Controls.Add(RadioButton4)

GroupBox2.Controls.Add(RadioButton5)

GroupBox2.Controls.Add(RadioButton6)

GroupBox3.Controls.Add(RadioButton7)

GroupBox3.Controls.Add(RadioButton8)

GroupBox3.Controls.Add(RadioButton9)

GroupBox3.Controls.Add(RadioButton10)

End Sub

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值