📄 windowhelper.cs
字号:
WS_HSCROLL = 0x00100000,
/// <summary>
/// Creates a window that is initially minimized. Same as the WS_MINIMIZE style.
/// </summary>
WS_ICONIC,
/// <summary>
/// Creates a window that is initially maximized.
/// </summary>
WS_MAXIMIZE,
/// <summary>
/// Creates a window that has a Maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style.
/// </summary>
WS_MAXIMIZEBOX = 0x00020000,
/// <summary>
/// Creates a window that is initially minimized. Same as the WS_ICONIC style.
/// </summary>
WS_MINIMIZE,
/// <summary>
/// Creates a window that has a Minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style.
/// </summary>
WS_MINIMIZEBOX = 0x00010000,
/// <summary>
/// Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_TILED style.
/// </summary>
WS_OVERLAPPED = WS_BORDER | WS_CAPTION,
/// <summary>
/// Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style.
/// </summary>
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED,
/// <summary>
/// Creates a pop-up window. This style cannot be used with the WS_CHILD style.
/// </summary>
WS_POPUP = unchecked((int)0x80000000),
/// <summary>
/// Creates a pop-up window with WS_BORDER, WS_POPUP, and WS_SYSMENU styles. The WS_CAPTION and WS_POPUPWINDOW styles must be combined to make the window menu visible.
/// </summary>
WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU,
/// <summary>
/// Creates a window that has a sizing border. Same as the WS_THICKFRAME style.
/// </summary>
WS_SIZEBOX = 0x00040000,
/// <summary>
/// Creates a window that has a Close (X) button in the non-client area.
/// </summary>
WS_SYSMENU = 0x00080000,
/// <summary>
/// Specifies a control that can receive the keyboard focus when the user presses the TAB key. Pressing the TAB key changes the keyboard focus to the next control with the WS_TABSTOP style.
/// </summary>
WS_TABSTOP = 0x00010000,
/// <summary>
/// Creates a window that has a sizing border. Same as the WS_SIZEBOX style.
/// </summary>
WS_THICKFRAME = 0x00040000,
/// <summary>
/// Creates an overlapped window. An overlapped window has a title bar and a border. Same as the WS_OVERLAPPED style.
/// </summary>
WS_TILED = WS_OVERLAPPED,
/// <summary>
/// Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_OVERLAPPEDWINDOW style.
/// </summary>
WS_TILEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU,
/// <summary>
/// Creates a window that is initially visible.
/// </summary>
WS_VISIBLE = 0x10000000,
/// <summary>
/// Creates a window that has a vertical scroll bar.
/// </summary>
WS_VSCROLL = 0x00200000
}
//Listbox
public enum ListBoxStyle : int
{
LBS_NOTIFY = 0x0001,
LBS_SORT = 0x0002,
LBS_NOREDRAW = 0x0004,
LBS_MULTIPLESEL = 0x0008,
LBS_HASSTRINGS = 0x0040,
LBS_USETABSTOPS = 0x0080,
LBS_NOINTEGRALHEIGHT = 0x0100,
LBS_MULTICOLUMN = 0x0200,
LBS_WANTKEYBOARDINPUT= 0x0400,
LBS_EXTENDEDSEL = 0x0800,
LBS_DISABLENOSCROLL = 0x1000,
LBS_NODATA = 0x2000,
LBS_STANDARD = (LBS_NOTIFY | LBS_SORT | WindowStyle.WS_VSCROLL | WindowStyle.WS_BORDER)
}
public enum ComboBoxStyle
{
CBS_DROPDOWN = 0x0002,
CBS_DROPDOWNLIST = 0x0003,
CBS_AUTOHSCROLL = 0x0040,
CBS_OEMCONVERT = 0x0080,
CBS_SORT = 0x0100,
CBS_HASSTRINGS = 0x0200,
CBS_NOINTEGRALHEIGHT = 0x0400,
CBS_DISABLENOSCROLL = 0x0800,
CBS_UPPERCASE = 0x2000,
CBS_LOWERCASE = 0x4000,
}
public enum EditStyle
{
ES_LEFT = 0x0000,
ES_CENTER = 0x0001,
ES_RIGHT = 0x0002,
ES_MULTILINE = 0x0004,
ES_UPPERCASE = 0x0008,
ES_LOWERCASE = 0x0010,
ES_PASSWORD = 0x0020,
ES_AUTOVSCROLL = 0x0040,
ES_AUTOHSCROLL = 0x0080,
ES_NOHIDESEL = 0x0100,
ES_COMBOBOX = 0x0200,
ES_OEMCONVERT = 0x0400,
ES_READONLY = 0x0800,
ES_WANTRETURN = 0x1000,
ES_NUMBER = 0x2000,
}
#endregion
#region Windows messages
public enum WindowMessage: int
{
WM_PAINT = 0x000F,
WM_NOTIFY = 0x004E,
WM_HELP = 0x0053,
WM_CTLCOLOREDIT = 0x0133,
WM_CTLCOLORLISTBOX = 0x0134,
WM_CTLCOLORBTN = 0x0135,
WM_HIBERNATE = 0x03ff,
WM_SETTEXT = 0xC
}
public enum ListViewMessage: int
{
LVM_FIRST = 0x1000,
LVM_GETHEADER = LVM_FIRST + 31,
LVM_SETICONSPACING = LVM_FIRST + 53,
}
public enum EditMessage: int
{
EM_GETSEL = 0x00B0,
EM_SETSEL = 0x00B1,
EM_GETRECT = 0x00B2,
EM_SETRECT = 0x00B3,
EM_SETRECTNP = 0x00B4,
EM_SCROLL = 0x00B5,
EM_LINESCROLL = 0x00B6,
EM_SCROLLCARET = 0x00B7,
EM_GETMODIFY = 0x00B8,
EM_SETMODIFY = 0x00B9,
EM_GETLINECOUNT = 0x00BA,
EM_LINEINDEX = 0x00BB,
EM_LINELENGTH = 0x00C1,
EM_REPLACESEL = 0x00C2,
EM_GETLINE = 0x00C4,
EM_LIMITTEXT = 0x00C5,
EM_CANUNDO = 0x00C6,
EM_UNDO = 0x00C7,
EM_FMTLINES = 0x00C8,
EM_LINEFROMCHAR = 0x00C9,
EM_SETTABSTOPS = 0x00CB,
EM_SETPASSWORDCHAR = 0x00CC,
EM_EMPTYUNDOBUFFER = 0x00CD,
EM_GETFIRSTVISIBLELINE = 0x00CE,
EM_SETREADONLY = 0x00CF,
EM_GETPASSWORDCHAR = 0x00D2,
EM_SETMARGINS = 0x00D3,
EM_GETMARGINS = 0x00D4,
EM_SETLIMITTEXT = EM_LIMITTEXT,
EM_GETLIMITTEXT = 0x00D5,
EM_POSFROMCHAR = 0x00D6,
EM_CHARFROMPOS = 0x00D7
}
public enum ComboBoxMessage: int
{
CB_GETEDITSEL = 0x0140,
CB_LIMITTEXT = 0x0141,
CB_SETEDITSEL = 0x0142,
CB_ADDSTRING = 0x0143,
CB_DELETESTRING = 0x0144,
CB_GETCOUNT = 0x0146,
CB_GETCURSEL = 0x0147,
CB_GETLBTEXT = 0x0148,
CB_GETLBTEXTLEN = 0x0149,
CB_INSERTSTRING = 0x014A,
CB_RESETCONTENT = 0x014B,
CB_FINDSTRING = 0x014C,
CB_SELECTSTRING = 0x014D,
CB_SETCURSEL = 0x014E,
CB_SHOWDROPDOWN = 0x014F,
CB_GETITEMDATA = 0x0150,
CB_SETITEMDATA = 0x0151,
CB_GETDROPPEDCONTROLRECT = 0x0152,
CB_SETITEMHEIGHT = 0x0153,
CB_GETITEMHEIGHT = 0x0154,
CB_SETEXTENDEDUI = 0x0155,
CB_GETEXTENDEDUI = 0x0156,
CB_GETDROPPEDSTATE = 0x0157,
CB_FINDSTRINGEXACT = 0x0158,
CB_SETLOCALE = 0x0159,
CB_GETLOCALE = 0x015A,
CB_GETTOPINDEX = 0x015b,
CB_SETTOPINDEX = 0x015c,
CB_GETHORIZONTALEXTENT = 0x015d,
CB_SETHORIZONTALEXTENT = 0x015e,
CB_GETDROPPEDWIDTH = 0x015f,
CB_SETDROPPEDWIDTH = 0x0160,
CB_INITSTORAGE = 0x0161
}
public enum NotificationMessage: int
{
TCN_FIRST = (0-550),
TCN_SELCHANGED = (TCN_FIRST - 1),
TCN_SELCHANGING = (TCN_FIRST - 2),
}
#endregion
#region WindowPos enumerations
//WindowPosZOrder
public enum SetWindowPosZOrder
{
HWND_TOP = 0,
HWND_BOTTOM = 1,
HWND_TOPMOST = -1,
HWND_NOTOPMOST = -2,
HWND_MESSAGE = -3
}
public enum SetWindowPosFlags
{
SWP_NOSIZE = 0x0001,
SWP_NOMOVE = 0x0002,
SWP_NOZORDER = 0x0004,
SWP_NOREDRAW = 0x0008,
SWP_NOACTIVATE = 0x0010,
SWP_FRAMECHANGED = 0x0020,
SWP_SHOWWINDOW = 0x0040,
SWP_HIDEWINDOW = 0x0080,
SWP_NOCOPYBITS = 0x0100,
SWP_NOOWNERZORDER = 0x0200,
SWP_NOSENDCHANGING = 0x0400,
SWP_DRAWFRAME = SWP_FRAMECHANGED,
SWP_NOREPOSITION = SWP_NOOWNERZORDER,
SWP_DEFERERASE = 0x2000,
SWP_ASYNCWINDOWPOS = 0x4000
}
#endregion
[DllImport("coredll.dll")]
public static extern IntPtr CreateWindowExW(IntPtr dwExStyle, string lpClassName,
string lpWindowName,IntPtr dwStyle, int X, int Y, int cx, int cy,
IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);
/// <summary>
/// This function destroys the specified window.
/// </summary>
/// <param name="hWnd">Handle to the window to be destroyed.</param>
/// <returns>Nonzero indicates success.</returns>
[DllImport("coredll.dll")]
public static extern IntPtr DestroyWindow(IntPtr hWnd);
/// <summary>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -