Borderless forms, user controls, timer controls

Source: Internet
Author: User

A. Borderless form
1 Maximize, minimize, and close button creation
is actually the change of the pre-click, point-and-click pictures

(1) Put the picture in the Debug folder,
Get the path to a picture
Application.startuppath + "\ \ Picture name. Type"
(2) If you put it in the folder,
Application.startuppath + "\ \". \\.. \\images\\ picture name. Type "

\.. \ folder name ... Turn up a folder, above the first \ is escaped

" \\1.png ");

2 form Moving up
Call the form to move the API, if there are other controls covering the form, then write the mouse down the event committee
You can do it.

//Form Mobile API[DllImport ("user32.dll")]         Public Static extern BOOLreleasecapture (); [DllImport ("user32.dll")]         Public Static extern BOOLSendMessage (INTPTR hwnd,intWmsg,intWParam,intIparam);  Public Const intWm_syscommand =0x0112;  Public Const intSc_move =0xf010;  Public Const intHtcaption =0x0002; [DllImport ("User32")]        Private Static extern intSendMessage (INTPTR hwnd,intWmsg,intWParam, IntPtr lParam); Private Const intWm_setredraw =0xB;//Remember: Be sure to select Form1_mousedown in the MouseDown event of the formPrivate voidForm1_mousedown (Objectsender, MouseEventArgs e) {            if( This. WindowState = =formwindowstate.normal) {releasecapture (); SendMessage ( This. Handle, Wm_syscommand, Sc_move + htcaption,0); }        }

3 Make a form shaded

//Shadows
Written above the constructor
Private Const intCs_dropshadow =0x20000; Private Const intGcl_style = (- -); [DllImport ("user32.dll", CharSet =CharSet.Auto)] Public Static extern intSetclasslong (INTPTR hwnd,intNIndex,intDwnewlong); [DllImport ("user32.dll", CharSet =CharSet.Auto)] Public Static extern intGetclasslong (INTPTR hwnd,intNIndex); Written in the constructor Setclasslong ( This. Handle, Gcl_style, Getclasslong ( This. Handle, Gcl_style) | Cs_dropshadow);

Second, create the control in the background

(1) Create

            New PictureBox ();//Create a picture control, instantiate a picture control            //Set Picture
" \\dota_img5.jpg " ); = Imagelayout.stretch; New textbox ();//Create a TextBox control, instantiate FLOWLAYOUTPANEL1.CONTROLS.ADD (p);//Put in a collection of streaming layouts FLOWLAYOUTPANEL1.CONTROLS.ADD (TB);

(2) Changing control properties

 foreach  (Control ct in   Flowlayoutpanel1.controls) { if  (Ct is   textbox) {(textbox) CT). Text  =  123123   ";  }}  

Third, user control
1 is a user-defined control that is made up of other controls
The body of a user control is similar to a panel, but it is a separate class
2 Create
New item--user control--named (used as a panel)--into other controls, all internal
The control access permissions are modified.
Appears in the toolbox after creation is complete.
3 Use
Instantiate Yonghu yh=new Yonghu ();//yonghu is the name I created for me.
Assignment yh.textbox1.text= "";
Put in a flow-style layout
4 mouse events can be added to the user control and the controls in it
Iv. timer in the component:
Enabled-whether this control is enabled
Interval-interval time, milliseconds
Tick event-code snippet to execute after a specified time interval
A timer is a thread that, by default, can access objects across threads

Borderless forms, user controls, timer controls

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.