让Winform窗体可以浮动停靠在Max系统内

测试于2018,低版本应该不可用

rollout maxFormBuilderRoll ""
(
    local theFrm = dotNetObject "MaxCustomControls.MaxForm"
    local theBtn = dotNetObject "System.Windows.Forms.Button"
    
    fn theFunc = messageBox "456"
    
    fn init =
    (
        theBtn.Location = dotNetObject "System.Drawing.Point" 10 20
        theBtn.Text = "按钮"
        theBtn.Size = dotNetObject "System.Drawing.Size" 120 50
        -- 让按钮使用max系统风格
        theBtn.FlatStyle = (dotNetClass "System.Windows.Forms.FlatStyle").System

        theFrm.Text = "窗口标题"
        theFrm.controls.add theBtn
        
        theFrm.StartPosition = (dotNetClass "System.Windows.Forms.FormStartPosition").CenterScreen
        
        --theHwnd = (dotNetObject "System.Windows.Forms.NativeWindow").FromHandle (DotNetObject "System.IntPtr" (windows.getMAXHWND()))
        --theFrm.Show(theHwnd)
        
        --让maxForm停靠在max内
        theFrm.ShowInFrame()
    )
)

maxFormBuilderRoll.init()

猜你喜欢

转载自www.cnblogs.com/trykle/p/12462450.html
今日推荐