A. Borderless form
1. How to make the control button
mouseenter-events that occur when the mouse is moved in
Picturebox1.backgroundimage = Image.FromFile (application.startuppath + "\ \". \\.. \\images\\btn_close_highlight.png ");
mouseleave-events that occur when the mouse is moved out
Picturebox1.backgroundimage = Image.FromFile (application.startuppath + "\ \". \\.. \\images\\btn_close_disable.png ");
mousedown-events that occur when the mouse is pressed
Picturebox1.backgroundimage = Image.FromFile (application.startuppath + "\ \". \\.. \\images\\btn_close_down.png ");
2. How to make a form move
APIs that are moved directly with the calling form
The code can be pasted directly as follows
Form Mobile API
[DllImport ("User32.dll")]
public static extern bool ReleaseCapture ();
[DllImport ("User32.dll")]
public static extern bool SendMessage (INTPTR hwnd, int wmsg, int wParam, int iparam);
public const int wm_syscommand = 0x0112;
public const int sc_move = 0xf010;
public const int htcaption = 0x0002;
[DllImport ("user32")]
private static extern int SendMessage (INTPTR hwnd, int wmsg, int wParam, IntPtr lParam);
Private Const int wm_setredraw = 0xB;
private void Form1_mousedown (object sender, MouseEventArgs e)
{
if (this. WindowState = = formwindowstate.normal)
{
ReleaseCapture ();
SendMessage (this. Handle, Wm_syscommand, Sc_move + htcaption, 0);
}
}
3. How to make a form shaded
Private Const int Cs_dropshadow = 0x20000;
Private Const int Gcl_style = (-26);
[DllImport ("user32.dll", CharSet = CharSet.Auto)]
public static extern int Setclasslong (INTPTR hwnd, int nIndex, int dwnewlong);
[DllImport ("user32.dll", CharSet = CharSet.Auto)]
public static extern int Getclasslong (INTPTR hwnd, int nIndex);
Public Form1 ()
{
InitializeComponent ();
Setclasslong (this. Handle, Gcl_style, Getclasslong (this. Handle, Gcl_style) | Cs_dropshadow);
}
Timer control
There are two properties commonly used:
Enabled-whether this control is enabled
Interval-interval time, milliseconds
There is only one event:
Tick event-The code snippet to be executed after the specified time interval, click in to write code.
No Border form Timer control