
正文
vb.net窗体设计插件 vb 窗体
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb.net如何调用窗体之间的控件
Public Class ks
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents tx As System.Windows.Forms.TextBox
Friend WithEvents ty As System.Windows.Forms.TextBox
Friend WithEvents tz As System.Windows.Forms.TextBox
Friend WithEvents ok As System.Windows.Forms.Button
Friend WithEvents l1 As System.Windows.Forms.Label
Friend WithEvents l2 As System.Windows.Forms.Label
Friend WithEvents l3 As System.Windows.Forms.Label
System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()
Me.l1 = New System.Windows.Forms.Label
Me.l2 = New System.Windows.Forms.Label
Me.l3 = New System.Windows.Forms.Label
Me.tx = New System.Windows.Forms.TextBox
Me.ty = New System.Windows.Forms.TextBox
Me.tz = New System.Windows.Forms.TextBox
Me.ok = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'l1
'
Me.l1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.l1.Location = New System.Drawing.Point(8, 8)
Me.l1.Name = "l1"
Me.l1.Size = New System.Drawing.Size(200, 16)
Me.l1.TabIndex = 0
'
'l2
'
Me.l2.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.l2.Location = New System.Drawing.Point(8, 32)
Me.l2.Name = "l2"
Me.l2.Size = New System.Drawing.Size(200, 16)
Me.l2.TabIndex = 1
'
'l3
'
Me.l3.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.l3.Location = New System.Drawing.Point(8, 56)
Me.l3.Name = "l3"
Me.l3.Size = New System.Drawing.Size(200, 16)
Me.l3.TabIndex = 2
'
'tx
'
Me.tx.Location = New System.Drawing.Point(8, 80)
Me.tx.Name = "tx"
Me.tx.Size = New System.Drawing.Size(200, 25)
Me.tx.TabIndex = 3
Me.tx.Text = "请输入x"
'
'ty
'
Me.ty.Location = New System.Drawing.Point(8, 104)
Me.ty.Name = "ty"
Me.ty.Size = New System.Drawing.Size(200, 25)
Me.ty.TabIndex = 4
Me.ty.Text = "请输入y"
'
'tz
'
Me.tz.Location = New System.Drawing.Point(8, 128)
Me.tz.Name = "tz"
Me.tz.Size = New System.Drawing.Size(200, 25)
Me.tz.TabIndex = 5
Me.tz.Text = "请输入z"
'
'ok
'
Me.ok.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.ok.Location = New System.Drawing.Point(8, 160)
Me.ok.Name = "ok"
Me.ok.Size = New System.Drawing.Size(200, 64)
Me.ok.TabIndex = 6
Me.ok.Text = "ok"
'
'ks
'
Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
Me.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(216, 232)
Me.Controls.Add(Me.ok)
Me.Controls.Add(Me.tz)
Me.Controls.Add(Me.ty)
Me.Controls.Add(Me.tx)
Me.Controls.Add(Me.l3)
Me.Controls.Add(Me.l2)
Me.Controls.Add(Me.l1)
Me.Name = "ks"
Me.Text = "考试"
Me.ResumeLayout(False)
End Sub
#End Region
Dim x, y, z, a, b, c, d, aa, bb, cc As Single
Dim tts, alls As Single
Private Sub ks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = Int(1 + 30 * Rnd())
y = Int(1 + 20 * Rnd())
z = Int(1 + 25 * Rnd())
a = Int(2 + 4 * Rnd())
b = Int(1 + a * 2 * Rnd())
c = Int(1 + b * 2 * Rnd())
d = Int(1 + c * 3 * Rnd())
aa = x + y + z
bb = a * x + b * y + c * z
cc = b * x + c * y + d * z
l1.Text = "x+y+z=" Str(aa)
l2.Text = Str(a) "x+" Str(b) "y+" Str(c) "z=" Str(bb)
l3.Text = Str(b) "x+" Str(c) "y+" Str(d) "z=" Str(cc)
End Sub
Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ok.Click
If Val(tx.Text) = x And Val(ty.Text) = y And Val(tz.Text) = z Then
tts = tts + 1
End If
alls = alls + 1
tx.Text = ""
ty.Text = ""
tz.Text = ""
x = Int(1 + (1000 ^ 0.5) * Rnd())
y = Int(1 + (10000 ^ 0.4) * Rnd())
z = Int(1 + (100000 ^ 0.3) * Rnd())
a = Int(2 + 4 * Rnd())
b = Int(1 + a * 2 * Rnd())
c = Int(1 + b * 2 * Rnd())
d = Int(1 + c * 3 * Rnd())
aa = x + y + z
bb = a * x + b * y + c * z
cc = b * x + c * y + d * z
l1.Text = "x+y+z=" Str(aa)
l2.Text = Str(a) "x+" Str(b) "y+" Str(c) "z=" Str(bb)
l3.Text = Str(b) "x+" Str(c) "y+" Str(d) "z=" Str(cc)
End Sub
Private Sub ks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
Dim lv As Single
If Not (alls = 0) Then
lv = Int(tts * 100000 / alls) / 1000
MsgBox(Str(lv) "%", , "正确率")
tx.Visible = False
ty.Visible = False
tz.Visible = False
ok.Visible = False
l1.Visible = False
l2.Visible = False
l3.Visible = False
Else
MsgBox("答题!", , "答题!")
End If
End Sub
End Class
相关问答
Q1: 在vb.net中,窗体设计器窗口的作用
Windows 窗体设计器的作用是( B) 。
A. 编写程序代码 B. 设计用户界面
C. 提供 Windows 窗体控件 D. 显示指定对象的属性
Q2: 用VB.NET轻松制作特效窗体
体是Windows应用程序的基础 新一代的开发工具Visual Basic Net为设计制作窗体提供了更多简单而丰富的方法 无需再求助于复杂而易错的API函数 我们就可以轻松制作多种特效窗体 轻松制作透明窗体VB NET可以轻松制作出任一透明度的窗体 我们只要在窗体的 属性 窗口中 将 Opacity 属性设置为一个介于 (完全透明)与 (完全不透明)之间的值就可以了 Dim frm As FrmTrans = New FrmTrans()frm Opacity = frm ShowDialog() 轻松制作始终位于最上层的窗体在VB 中 要制作一个始终位于最上层的窗体我们只能求助于令人头痛的API函数 然而在 NET 中 我们只要简单设置窗体的 TopMost 属性就可实现同样效果了!例如 Dim frm As frmTopMost = New frmTopMost()frm TopMost = Truefrm Show() 轻松制作不可见的窗体如果要编写一个不让别人发现的隐藏程序 制作不可见的窗体就是必须实现的第一步 窗体的可见性通常由 Visible 属性控制 但是 如果希望 Windows 应用程序的主窗体在应用程序启动时不可见 您将会发现将它的 Visible 属性设置为 False 的方法无效 窗体总会自己显示出来(这是因为 启动窗体的生存期决定了应用程序的生存期) 虽然如此 我们还是可以通过简单将应用程序的启动设置为一个模块 从而从窗体的生存期分出应用程序的生存期 轻松实现不可见的窗体 在下面这个例子中 窗体在特定的时间内自动隐藏 ( )在 Visual Basic 中 右击项目并选择 添加模块 以将模块添加到 Windows 应用程序 ( )在已添加的模块(或类)内 创建可作为项目启动对象的 Main 函数 Sub main()Dim f As New Form ()f Visible = FalseWhile Hour(Date Now) 如果当前时间早于 点 窗体自动隐藏Application DoEvents()End Whilef ShowDialog()End Sub 轻松编写托盘程序托盘程序作为一类特殊的窗体 其快捷图标显示在系统托盘中 窗体本身则隐藏不可见 在 NET之前版本的VB中编写托盘程序是十分困难的 但是VB NET提供的新的NotifyIcon组件却使VB初学者也能轻松编写一个这样的程序 新建 Windows应用程序 设置主窗体Opacity属性为 FormBorderStyle属性为None ShowInTaskbar属性为False 这样窗体将在启动后隐藏 在窗体上放置一个NotifyIcon组件NotifyIcon 一个ContextMenu(弹出菜单)组件ContextMenu 并根据需要为ContextMenu 添加菜单项 设置NotifyIcon 的ICON属性 这个图标就是应用程序出现在系统托盘中的快捷图标 设置NotifyIcon 的Text属性为 VB NET托盘程序 这就是鼠标移动到托盘图标时弹出的文字说明 设置NotifyIcon 的ContextMenu属性为ContextMenu 也就是右键单击快捷图标时的弹出菜单为ContextMenu OK 按F 运行!几乎不用编写代码 一个托盘程序就这样轻松实现了 lishixinzhi/Article/program/net/201311/13831
vb.net窗体设计插件的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb 窗体、vb.net窗体设计插件的信息别忘了在本站进行查找喔。






