以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]窗口嵌入  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=80441)

--  作者:vvfree
--  发布时间:2016/1/22 20:11:00
--  [求助]窗口嵌入
窗口2嵌入窗口1,且可以在窗口1里来回拖动,就想嵌入EXE一样,请问要怎么做?
--  作者:Hyphen
--  发布时间:2016/1/23 9:19:00
--  
参考:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=77912

全局代码:
\'无边框移动控制---------------------------
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer,ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Integer) As Integer
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2
Public Sub Panel_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs)
If e.Button=MouseButtons.Left Then
    ReleaseCapture()
    SendMessage(sender.Parent.Handle.ToInt32, WM_NCLBUTTONDOWN, HTCAPTION, 0)
End If
End Sub

窗口1,AfterLoad
AddHandler e.Form.Panel.MouseDown,AddressOf Panel_MouseDown

加载窗口1改改
......
    Dim Name As String = "窗口1"
    tab.TabPages.Add(name,name)
    Dim pb = tab.BaseControl
    Forms(Name).OPEN(10,10)
    Forms(Name).BaseForm.TopLevel = False
    Forms(Name).BaseForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
    \'Forms(Name).BaseForm.Dock = System.Windows.Forms.DockStyle.Fill  \'这一句注释掉
    PB.TabPages(name).Controls.Clear
    PB.TabPages(name).Controls.add(Forms(Name).BaseForm)
    tab.SelectedPage = tab.TabPages(name)
    vars("父tab") = tab
......

--  作者:vvfree
--  发布时间:2016/1/23 16:46:00
--  回复:(Hyphen)参考:http://www.foxtable.com/bbs/...

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20160123164434.png
图片点击可在新窗口打开查看

--  作者:Hyphen
--  发布时间:2016/1/23 17:04:00
--  
贴出完整错误代码
--  作者:vvfree
--  发布时间:2016/1/23 17:56:00
--  回复:(Hyphen)贴出完整错误代码

已经可以了 谢谢