创建运行时用户控件? [英] Creating Runtime User Control ?
本文介绍了创建运行时用户控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我想创建一个新的用户控件,其中包含一个带有3个单选按钮的组框,组框和在运行时在用户控件内创建的单选按钮.
我的问题是,在vb2008表单上添加用户控制时,组框和单选按钮没有出现.
请帮忙吗?
从OP的评论中添加
以下属性用于创建带有单选按钮的分组框.
Hi
i want to create a new user control, which contain one groupbox with 3 radio buttons, the group box and radio buttons created at runtime inside the user control.
my problem, the groupbox and radio buttons didnt appear when add the user contol on the vb2008 form.
please help?
Added from OP''s comment
the following property use to create a groupbox with radio buttons.
Public Property TableCheckTypes() As DataTable
Get
Return m_TableCheckTypes
End Get
Set(ByVal value As DataTable)
m_TableCheckTypes = value
If m_TableCheckTypes Is Nothing Then Exit Property
GroupBox1 = New System.Windows.Forms.GroupBox
GroupBox1.Location = New Point(280, 10)
GroupBox1.Size = New Size(29, 25)
Dim Counter As Integer = 0
For Each row As DataRow In m_TableCheckTypes.Rows
rdo = New System.Windows.Forms.RadioButton
rdo.Name = "rdo" & Counter + 1
rdo.Appearance = System.Windows.Forms.Appearance.Button
rdo.Size = New Size(25, 25)
rdo.Location = New Point(2, 8 + (Counter * 24))
rdo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
rdo.UseVisualStyleBackColor = True
rdo.Text = row("CheckTypeCode")
rdo.Tag = row("CheckTypeID")
AddHandler rdo.CheckedChanged, AddressOf rdo_CheckedChanged
GroupBox1.Controls.Add(rdo)
rdo.Visible = True
rdo.BringToFront()
Counter += 1
Next
GroupBox1.Height = Counter * 24 + 10
MyBase.Controls.Add(GroupBox1)
GroupBox1.BringToFront()
GroupBox1.Visible = True
End Set
End Property
推荐答案
没有看到部分代码或全部代码,我们真的看不到哪里出错了!
with out seeing some code part of or all we can''t really see where you have gone wrong!
这篇关于创建运行时用户控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文