In C # WinForm, the border does not appear to cause the form can not be dragged, the bottom of the code to add up can be resolved.

Source: Internet
Author: User

In C # WinForm, the border does not appear to cause the form can not be dragged, the bottom of the code to add up can be resolved.

1. Import namespaces
Using System.Runtime.InteropServices;
2. Enter the following code


[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 Picturebox2_click (object sender, EventArgs e)
{
Application.exit ();
}

private void Picturebox4_click (object sender, EventArgs e)
{
This. WindowState = formwindowstate.minimized;
}
Write the following code in the MouseDown event of the form
private void Zcmmform_mousedown (object sender, MouseEventArgs e)
{
if (E.button = = MouseButtons.Left)
{
ReleaseCapture (); SendMessage (Handle, 0xa1, 0x02, 0);
}
}

An issue in which a form cannot be dragged after it has been removed

In C # WinForm, the border does not appear to cause the form can not be dragged, the bottom of the code to add up can be resolved.

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.