vb.netmdi窗体 vbs窗体( 二 )


Dim NewMDIChild As New Form2
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
Public Shared Sub CheckMDIChildForm(ByVal MDIForm As Windows.Forms.Form, ByVal MDIChildForm As Windows.Forms.Form, ByVal MDIChildFormName As String)
If MDIForm.MdiChildren.Length1 Then
'如果没有任何一个MDI子窗体,则创该MDI子窗体的窗体实例
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
Exit Sub
Else
Dim x As Integer
Dim frmyn As Boolean
For x = 0 To (MDIForm.MdiChildren.Length) - 1
Dim tempChild As Windows.Forms.Form = CType(MDIForm.MdiChildren(x), Windows.Forms.Form)
If tempChild.Name = MDIChildFormName Then
'检测到有该MDI子窗体,设为激活 并退出循环
frmyn = True
tempChild.BringToFront()
Exit For
Else
frmyn = False
End If
Next
If Not frmyn Then
'在打开的窗体中没检测到则新建
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
End If
End If
End Sub
vb.net设置mdi子窗口随父窗口的大小而变化简单一点vb.netmdi窗体的方式是vb.netmdi窗体,在MDI主窗体内添加一个picturebox控件,然后在这个picturebox中添加一个image控件 。
Picture1vb.netmdi窗体的属性:
1.Align=top
2.Appearance=flat
3.BordeStyle=None
4.TabStop=false
Image1vb.netmdi窗体的属性:
1.Stretch=true
在MDI窗体的resize事件中添加如下代码:
Private Sub MDIForm_Resize()
Me.Picture1.Height = Me.Height
End Sub
在Picture1控件的resize事件中添加如下代码:
Private Sub Picture1_Resize()
Me.Image1.Move 0, 0, Me.Picture1.Width, Me.Picture1.Height
End Sub
【vb.netmdi窗体 vbs窗体】vb.netmdi窗体的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vbs窗体、vb.netmdi窗体的信息别忘了在本站进行查找喔 。

推荐阅读