How to drag a WinForm without a title bar form, winform title bar

Source: Internet
Author: User

How to drag a WinForm without a title bar form, winform title bar

Change the form name to Form_HoverTree.

Download the source code.

Main Code:

Point _ HoverTreePosition; public Form_HoverTree () {InitializeComponent (); _ HoverTreePosition = new Point ();} /// <summary> /// record the start position of the mouse, hovertree.com // </summary> private void Form_HoverTree_MouseDown (object sender, MouseEventArgs e) {_ HoverTreePosition. X = e. x; _ HoverTreePosition. Y = e. Y ;}/// <summary> /// hold down the left button and move the mouse over the form.-Why? // </summary> private void Form_HoverTree_MouseMove (object sender, MouseEventArgs e) {if (e. button = MouseButtons. left) {Point h_myPosittion = MousePosition; h_myPosittion.Offset (-_ HoverTreePosition. x,-_ HoverTreePosition. y); Location = h_myPosittion ;}}

:

It can be seen that this form is a custom form with no title bar. Reference: http://hovertree.com/h/bjaf/52nadvt4.htm

Download source code:

Http://hovertree.com/h/bjaf/j4wwteu3.htm

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.