大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
jbp4b9ae4a2e8 ,你真是刷分大王!
成都网站制作、成都做网站,成都做网站公司-创新互联已向1000多家企业提供了,网站设计,网站制作,网络营销等服务!设计与技术结合,多年网站推广经验,合理的价格为您打造企业品质网站。
经验值 财富值 采纳率 提问数 回答数 精彩回答 赞同数 经验数
938574 965990 0% 78441 0 0 0 0
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
1,添加一个模块,在模块里声明一个全局公共变量N;
2,在控件的调用窗体代码段里,把此控件名称给这个全局公共变量N赋值;
3,在窗体的Load()事件里,写代码: Me.Text = N。
窗体默认是顶级控件,不能添加到其他容器中
如果想将窗体像一般控件那样添加进容器中,需要将窗体的TopLevel属性设为false
如下:
Dim
fir
As
New
Form2
fir.TopLevel
=
false
Me.Panel1.Controls.Add(fir)
FolderBrowserDialog可以实现
Windows 窗体编程
FolderBrowserDialog 组件概述(Windows 窗体)
请参见 发送反馈意见
Windows 窗体 FolderBrowserDialog 组件是用于浏览和选择文件夹的模式对话框。也可以从 FolderBrowserDialog 组件内创建新文件夹。
注意:
若要选择文件而不是文件夹,请使用 OpenFileDialog 组件。
使用 ShowDialog 方法,可在运行时显示 FolderBrowserDialog 组件。设置 RootFolder 属性可确定将出现在对话框的树状视图中的顶级文件夹和任何子文件夹。在对话框显示后,就可以使用 SelectedPath 属性获取所选文件夹的路径。
将 FolderBrowserDialog 组件添加到窗体后,它就会出现在“Windows 窗体设计器”底部的栏中。
请参见
概念
如何:使用 Windows 窗体 FolderBrowserDialog 组件选择文件夹
FolderBrowserDialog 组件(Windows 窗体)
参考
FolderBrowserDialog
上面是MSDN的帮助文档,说的很清楚了
其实只要往大的panel里添加小panel就不会出现上述情况,子控件的坐标都是相对于父控件的,不应该存在 "页" 的概念.