好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

C# 实现窗口无边框,可拖动效果

具体代码如下所示:

?

#region 无边框拖动效果

    [dllimport( "user32.dll" )] //拖动无窗体的控件

    public static extern bool releasecapture();

    [dllimport( "user32.dll" )]

    public static extern bool sendmessage(intptr hwnd, int wmsg, int wparam, int lparam);

    public const int wm_syscommand = 0x0112;

    public const int sc_move = 0xf010;

    public const int htcaption = 0x0002;

    private void start_mousedown( object sender, mouseeventargs e)

    {

      //拖动窗体

      releasecapture();

      sendmessage( this .handle, wm_syscommand, sc_move + htcaption, 0);

    }

    #endregion

在窗口属性界面添加事件服务

总结

以上所述是小编给大家介绍的c# 实现窗口无边框,可拖动效果,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:https://HdhCmsTestcnblogs测试数据/huanjun/archive/2018/03/22/8625686.html

dy("nrwz");

查看更多关于C# 实现窗口无边框,可拖动效果的详细内容...

  阅读:51次