弹框
MessageBox.Show();
清空
clear()
字符串拼接
string
公共控件
button 按钮
checkbox 复选框
checklistbox 多个复选框
combobox 可以编辑的文本框
datatimepicker 日期控件
label 文字
linklabel 像超链接的文字
notifyicon 在小任务栏里显示本窗口图标
textbox 允许用户输入文本
picturebox 图片框
radiobotton 单选框
combobox 下拉菜单
容器
panel 容器
窗体无边框移动Api
//窗体移动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, );
}
}
窗口阴影Api
、添加命名空间:
using System.Runtime.InteropServices; 、定义常量值及函数:
private const int CS_DropSHADOW = 0x20000;
private const int GCL_STYLE = (-);
[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); 、构造方法下引用:
SetClassLong(this.Handle, GCL_STYLE, GetClassLong(this.Handle, GCL_STYLE) | CS_DropSHADOW);
控制窗口关闭
this.Close(); // 窗口关闭
控制窗口最小化
this.WindowState = FormWindowState.Minimized;