首页 | 互联网 | IT动态 | IT培训 | Cisco | Windows | Linux | Java | .Net | Oracle | 软件测试 | C/C++ | 嵌入式开发 | 存储世界 | 服务器
网络设备 | IDC | 安全 | 求职招聘 | 数字网校 | 网页设计 | 平面设计 | 技术专题 | 电子书下载 | 教学视频 | 源码下载 | 搜索 | 博客 | 论坛
中国IT实验室Dotnet频道
中国IT教育
Google
首页 ASP.NET  C#  XML/WebService ADO.NET VC.NET VB.NET .NET 资讯动态 专题 RSS订阅 讨论 下载
您现在的位置: 中国IT实验室 >> Dotnet >> VB.NET >> 正文

vb.net入门之分组控件:GroupBox控件

  '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

  把上一页的代码复制添加后,把控件初始化过程InitializeControl()过程添加到Form1的New构造函数中,如下图二所示:

  vb.net入门——分组控件:GroupBox控件的使用(图三)

  图二:在New构造函数中添加过程InitializeControl()

  现在按F5运行,Form1的窗体控件布局(如下图三所示)是不是和我们手工布局的图一的布局是一样的呢?

  vb.net入门——分组控件:GroupBox控件的使用(图二)

  图三:使用代码动态生成的控件布局图

上一页  [1] [2] [3] 

【责编:John】

中国IT教育

相关产品和培训
文章评论
 友情推荐链接
 认证培训
 专题推荐

 ·WEB程序开发--ASP.NET和PHP、JSP究竟学哪个?
 ·五步带你入门XML
 ·关于Java框架技术专题
 ·XML全攻略技术专题
 ·JAVA开源技术介绍专题
 ·Java嵌入式开发之J2ME技术专题
 ·超前体验 Oracle 11g的5个新特性…
 ·揭密使用VB.NET的五个实用技巧
 ·Oracle和SQL Server常用函数对比专题…
 ·展现C#世界 C#程序设计专题…
 今日更新
 社区讨论
 博客论点
 频道精选
 Dotnet频道相关导航