用以下方法加载了子窗口
Dim newf As New Form1
newf.Caption = "窗口" + Str(n)
newf.Show
newf.Tag = 1我在MDI里面放了几个按键,并与相应的子窗口对应,然后点击某个按键就可以将相应的窗口置前,但是按键的内容不知道如何编写,发现所有的子窗口都叫Form1,试了一晚上了也没成功。
不知有高手能指教下不?
谢谢
Dim newf As New Form1
newf.Caption = "窗口" + Str(n)
newf.Show
newf.Tag = 1我在MDI里面放了几个按键,并与相应的子窗口对应,然后点击某个按键就可以将相应的窗口置前,但是按键的内容不知道如何编写,发现所有的子窗口都叫Form1,试了一晚上了也没成功。
不知有高手能指教下不?
谢谢
编写:
public n as long
将你的代码修改为:
Dim newf As New Form1
newf.Caption = "窗口" & n
n = n + 1
newf.Show
Option ExplicitPrivate Sub Command1_Click(Index As Integer)
Dim frm As Form
Dim sCaption As String
sCaption = "窗体" & CStr(Index + 1)
For Each frm In Forms
If TypeOf frm Is Form1 Then
If frm.Caption = sCaption Then
frm.ZOrder
Exit Sub
End If
End If
Next
Set frm = New Form1
frm.Caption = sCaption
frm.Show
End SubPrivate Sub MDIForm_Load()
Dim i As Long
For i = 0 To Command1.UBound
Command1(i).Caption = "窗体" & CStr(i + 1)
Next
End Sub