标签:
这里笔者在网上找到了API函数SetParent(),并对网上的错误进行了改动,并给出了简单实例代码。
读者可自行測试:
Public Class Form1 '作者:章鱼哥,QQ:3107073263 群:309816713 '如有疑问或好的建议请联系我。大家一起进步 '声明SetParent函数。这是一个API函数 Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Long Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.IsMdiContainer = True '将Form1设置为父窗口容器 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Form1是父窗口,Form2是子窗口 SetParent(Form2.Handle, Me.Handle) Form2.Show() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click SetParent(Form3.Handle, Me.Handle) Form3.Show() End Sub End Class
VB.NET章鱼哥出品—怎样解决MDI子窗口被父窗口中的控件覆盖的问题
标签:
原文地址:http://www.cnblogs.com/yxwkf/p/5399411.html