大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
添加一个OPTION控件,复制-粘贴,建立 控件组
创新互联建站专注于网站建设|成都企业网站维护|优化|托管以及网络推广,积累了大量的网站设计与制作经验,为许多企业提供了网站定制设计服务,案例作品覆盖履带搅拌车等行业。能根据企业所处的行业与销售的产品,结合品牌形象的塑造,量身策划品质网站。
比如复制6个
代码如下
Private Sub Command1_Click()
For i = 0 To 5
If Option1(i).Value = True Then MsgBox Option1(i).Caption "被选中"
Next
End Sub
VB6中是ToggleButton控件
选择方法是添加部件 Microsoft Form 2.0 Object Library
假设radiobuttonlist ID = BMI
For i = 0 To BMI. Items.Count - 1
If BMI. Items(i). Selected Then
BMI. Items(i). Attributes.Add("style", "background-color: green;" )
End If
Next
将这些RadioButton控件放入一个容器中,,以Panel1为例,代码如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each R As RadioButton In Panel1.Controls
If R.Checked Then
Debug.WriteLine(R.Name " 被选中.")
End If
Next
End Sub
把那三个GroupBox放在Panel1中就行了.
Me.ListView1.Items(Me.ListView1.Items.Count - 1).Selected = True
Me.ListView1.EnsureVisible(Me.ListView1.Items.Count - 1)
button , OpenFileDialog , PictureBox , textbox 控件,我把图片显示在 picturebox 中,而路
径存放在 textbox 中,不知道这样行不行。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filename As String
OpenFileDialog1.Filter = "jpg files (*.jpg)|*.jpg"
OpenFileDialog1.FilterIndex = 1
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
filename = OpenFileDialog1.FileName
Else
End
End If
If Not (PictureBox1.Image Is Nothing) Then
PictureBox1.Image.Dispose()
PictureBox1.Image = Nothing
End If
'PictureBox1.Image = System.Drawing.Image.FromFile(filename)
去掉注释后就显示图片
TextBox1.Text = filename
End Sub
picturebox中只记录文件存放的路径,我找了一个 ImageLocation 函数
PictureBox1.ImageLocation = filename 不过还是会显示图片