×

vb panel控件

vb panel控件(vb更换标题栏颜色)

admin admin 发表于2024-04-12 02:57:49 浏览26 评论0

抢沙发发表评论

各位老铁们,大家好,今天由我来为大家分享vb panel控件,以及vb更换标题栏颜色的相关问题知识,希望对大家有所帮助。如果可以帮助到大家,还望关注收藏下本站,您的支持是我们最大的动力,谢谢大家了哈,下面我们开始吧!

本文目录

vb更换标题栏颜色

vb更换标题栏颜色具体步骤如下:1、设置窗口的边界属性(FormBorderStyle)为None,即不显示边界,此种情况下,窗体默认的标题栏就不会显示。2、接着,使用panel控件来做自己的标题栏,并将其绑定边框属性(Dock)设置为Top,使其显示在窗体顶部。设置其高度属性(Height)到一个合适的值,将其背景色属性(BackColor)设置为自己需要的颜色即可。

vb6.0怎么在statusbar控件中添加panel

在窗体上添加statusbar控件后,用右键单击状态栏,在弹出的菜单中选择"属性"项,选择"窗格"选项卡.单击"插入窗格"按钮,就OK了,最多只能添加16个.

VB.NET用panel装子窗体时提示“无法将顶级控件添加到控件“

窗体默认是顶级控件,不能添加到其他容器中如果想将窗体像一般控件那样添加进容器中,需要将窗体的TopLevel属性设为false如下:DimfirAsNewForm2fir.TopLevel=falseMe.Panel1.Controls.Add(fir)

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

  我们对控件进行分组的原因不外乎三个

   为了获得清晰的用户界面而将相关的窗体元素进行可视化分组

   编程分组 如对单选按钮进行分组

   为了在设计时将多个控件作为一个单元来移动

  在中 有GroupBox Panel TabControl这三个控件可以实现上面所提到的三个分组目的 所以我们称它们为分组控件

  这三个控件在功用上十分的相似 特别是GroupBox和Panel控件 只存在一点细微的差别而已(这个差别是 只有GroupBox控件可以显示标题 而只有Panel控件可以有滚动条) 这里我们就先来了解GroupBox控件的使用

  GroupBox(控件组)控件一般是作为其他控件的组的容器的形式存在的 这样有利于用户识别 使界面变得更加友好(GroupBox控件相当于Visual Basic以前版本的Frame控件) 使用控件组控件可以将一个窗体中的各种功能进一步进行分类 例如 将各种选项按钮控件分隔开

  当移动单个GroupBox控件时 它所包含的所有控件也将一起移动

  在大多数情况下 对控件组控件没有实际的操作 我们用它对控件进行分组 通常没有必要响应它的事件 不过 它的Name Text和Font等属性可能会经常被修改 以适应应用程序在不同阶段的要求

  GroupBox控件在工具箱中的图标如图所示

  一 GroupBox控件的常用属性

   Anchor和Dock 这两个属性是所有有用户界面的控件都有的定位属性 这里就不啰嗦了

   Name属性 标识控件的对象名称

   Text属性 显示在GroupBox控件右上方的标题文字 可以用来标识该控件组的描述

   Font和ForeColor属性 用于改变GroupBox控件的文字大小以及文字的颜色 需要注意的时候 它不单改变GroupBox控件的Text属性的文字外观 同时也改变其内部控件的显示的Text属性的文字外观

  二 创建一组控件

   在窗体上放置GroupBox控件 从工具箱中拖放一个GroupBox控件到窗体上的合适位置 调整大小

   在属性窗口中改变GroupBox控件的Text属性 作为它的标题

   在GroupBox控件内拖放其它需要的控件 例如RadioButton控件

   设置示例 如图一所示

  

  图一 用控件组控件对单选按钮分组

   我们在拖动单个GroupBox控件的时候 它内部的控件也会随着移动 以保持和GroupBox的相对位置不变 同理 删除GroupBox控件时 它所包含的所有控件也会被删除掉

   当我们调整GroupBox控件所包含的控件的Anchor和Dock属性的时候 其参照物将不是Form窗体 而是GroupBox控件了

  三 编程添加GroupBox控件以及它所包含的控件

  虽然GroupBox控件是在设计时用视图设计布局效果最好 但是无可避免地 很多特殊情况下也是需要在运行做添加控件到控件组中的 这里我们就用代码来完成上图一界面的绘制

  动态添加控件一般需要经过下面三个步骤

   创建要添加的控件实例

   设置新控件的属性

   将控件添加到父控件的 Controls 集合

  在Form 代码的任意位置增加初始化控件的过程InitializeControl() 代码如下所示

  Sub InitializeControl()

   首先添加Label和TextBox控件

  Dim Label As New System Windows Forms Label

  Dim TextBox As New System Windows Forms TextBox

   Label

  Label Location = New System Drawing Point( )

  Label Name = Label

  Label Size = New System Drawing Size( )

  Label TabIndex =

  Label Text = 户主姓名

   TextBox

  TextBox Location = New System Drawing Point( )

  TextBox Name = TextBox

  TextBox Size = New System Drawing Size( )

  TextBox TabIndex =

  TextBox Text =

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

  Me Controls Add(TextBox )

  Me Controls Add(Label )

   添加三个GroupBox控件

  Dim GroupBox As New System Windows Forms GroupBox

  Dim GroupBox As New System Windows Forms GroupBox

  Dim GroupBox As New System Windows Forms GroupBox

   GroupBox

  GroupBox BackColor = System Drawing SystemColors Control

  GroupBox Location = New System Drawing Point( )

  GroupBox Name = GroupBox

  GroupBox Size = New System Drawing Size( )

  GroupBox TabIndex =

  GroupBox TabStop = False

  GroupBox Text = 性别

   GroupBox

  GroupBox Location = New System Drawing Point( )

  GroupBox Name = GroupBox

  GroupBox Size = New System Drawing Size( )

  GroupBox TabIndex =

  GroupBox TabStop = False

  GroupBox Text = 单元

   GroupBox

  GroupBox Location = New System Drawing Point( )

  GroupBox Name = GroupBox

  GroupBox Size = New System Drawing Size( )

  GroupBox TabIndex =

  GroupBox TabStop = False

  GroupBox Text = 楼层

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

  Me Controls Add(GroupBox )

  Me Controls Add(GroupBox )

  Me Controls Add(GroupBox )

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

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

  Dim RadioButton As New System Windows Forms RadioButton

   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

  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

  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

  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中如何向TableLayoutPanel控件指定行和列写数据

SetCellPosition 设置表示单元格的行号和列号的 TableLayoutPanelCellPosition。SetColumn 设置指定子控件的列位置。SetColumnSpan 设置子控件跨的列数。SetRow 设置指定子控件的行位置。SetRowSpan 设置子控件跨的行数。

vb2015 工具箱里面的panel是干嘛的

Panel(面版) 控件用于为其他控件提供可识别的分组,其功能相当于vb6.0的Frame(框架)控件,只是没有Caption属性。

vb.net panel里的控件如何遍历

Public Sub ReSetText(Control ctrl)                Dim ct As Control        For Each ct In ctrl.Controls            Try                For Each ct2 As Control In ct.Controls                    ReSetText(ct2)                Next            Catch                        End Try            If (TypeOf ct Is TextBox) Then                ct.Text = ""            ElseIf (TypeOf ct Is ComboBox) Then                Dim cb As System.Windows.Forms.ComboBox = DirectCast(ct, System.Windows.Forms.ComboBox)                cb.SelectedIndex = -1            End If        NextEnd Sub

因为textbox在窗体里的panel里,你只遍历窗体的控件是不够的。

怎样在vb2005窗体内的panel控件上绘一条直线

第一步:引用进名字空间 using System.Drawing;第二步:拖一个panel到Form中,这里叫做panel1第三步:右键点击panel,打开属性,然后双击Paint的那个事件第四步:把这段代码粘贴到函数panel1_Paint中 Graphics g = panel1.CreateGraphics(); Pen red = new Pen(Color.Red, 3); g.DrawLine(red, 12, 12, 190, 190);第五步:运行,看到一条红色的直线了

如果你还想了解更多这方面的信息,记得收藏关注本站。