form是无边框,在web里面做标题栏,如何实现点web里面这个标题栏来拖动winfrom 的窗体?webbrowserform

解决方案 »

  1.   

    B/S还没有强大这个地步吧?随意控制winform窗体移动,除非用ACTIVE等插件技术
      

  2.   

    用js跟winform交互,不是什么难题。
    问题是web里的网页是不是你自己的。
      

  3.   

    web是自己的,js可以触发到winform里面的方法,就是不知道如何实现移动
      

  4.   

    既然网页是你的,那你网页内自己写好交互用的js。
    当你keydown网页内的标题栏时,js给winform个消息,winform收到消息后执行个方法,
    这个方法类似这样:
    private void MoveWindow()
    { // 给当前窗体发送个WM_LBUTTONDOWN 消息
      PostMessage((int)this.Handle, 0x0201, 0, 0);
    }//在窗体的mousedown下做窗口移动处理
    private void Form1_MouseDown(object sender, MouseEventArgs e)
    {
      ReleaseCapture();
      PostMessage((int)this.Handle, 0x0112, 0xf012, 0);
    }// 当然要引入这几个api
    using System.Runtime.InteropServices;
    [DllImport("user32.dll", EntryPoint = "PostMessage")]
    public static extern int PostMessage(
     int hwnd,int wMsg,int wParam,int lParam
    );
    [DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
    public static extern int ReleaseCapture();// 没条件测试,你自己测试下吧