C # WinForm remove a border and implement the drag function

Source: Internet
Author: User
In WinForm, when we put the properties of the form
FormBorderStyle
When you indicate that the appearance and behavior of the form's border and title bar are set to none, we find that the ability to drag the form disappears, and we can use the MouseDown event to register the ability to drag the mobile form, using the Windows API to implement the code as follows

[DllImport ("User32.dll")]
public static extern bool ReleaseCapture ();
[DllImport ("User32.dll")]
public static extern bool SendMessage (INTPTR hwnd, int wmsg, int wParam, int lParam);
private void Frmgampackagingscaledualsimple_mousedown (object sender, MouseEventArgs e)
{
if (E.button = = MouseButtons.Left)
{
ReleaseCapture ();
SendMessage (Handle, 0xa1, 0x02, 0);
}
}

C # WinForm remove a border and implement the drag function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.