📄 nativemethods.cs
字号:
// ---------------------------------------------------------
// Windows Forms CommandBar Control
// Copyright (C) 2001-2003 Lutz Roeder. All rights reserved.
// http://www.aisto.com/roeder
// roeder@aisto.com
// ---------------------------------------------------------
namespace Reflector.UserInterface
{
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Windows.Forms;
internal sealed class NativeMethods
{
private NativeMethods()
{
}
public const string TOOLBARCLASSNAME = "ToolbarWindow32";
public const int WS_CHILD = 0x40000000;
public const int WS_VISIBLE = 0x10000000;
public const int WS_CLIPCHILDREN = 0x2000000;
public const int WS_CLIPSIBLINGS = 0x4000000;
public const int WS_BORDER = 0x800000;
public const int CCS_NODIVIDER = 0x40;
public const int CCS_NORESIZE = 0x4;
public const int CCS_NOPARENTALIGN = 0x8;
public const int I_IMAGECALLBACK = -1;
public const int I_IMAGENONE = -2;
public const int TBSTYLE_TOOLTIPS = 0x100;
public const int TBSTYLE_FLAT = 0x800;
public const int TBSTYLE_LIST = 0x1000;
public const int TBSTYLE_TRANSPARENT = 0x8000;
public const int TBSTYLE_EX_DRAWDDARROWS = 0x1;
public const int TBSTYLE_EX_HIDECLIPPEDBUTTONS = 0x10;
public const int TBSTYLE_EX_DOUBLEBUFFER = 0x80;
public const int CDRF_DODEFAULT = 0x0;
public const int CDRF_SKIPDEFAULT = 0x4;
public const int CDRF_NOTIFYITEMDRAW = 0x20;
public const int CDDS_PREPAINT = 0x1;
public const int CDDS_ITEM = 0x10000;
public const int CDDS_ITEMPREPAINT = CDDS_ITEM | CDDS_PREPAINT;
public const int CDIS_HOT = 0x40;
public const int CDIS_SELECTED = 0x1;
public const int CDIS_DISABLED = 0x4;
public const int WM_SETREDRAW = 0x000B;
public const int WM_CANCELMODE = 0x001F;
public const int WM_NOTIFY = 0x4e;
public const int WM_KEYDOWN = 0x100;
public const int WM_KEYUP = 0x101;
public const int WM_CHAR = 0x0102;
public const int WM_SYSKEYDOWN = 0x104;
public const int WM_SYSKEYUP = 0x105;
public const int WM_COMMAND = 0x111;
public const int WM_MENUCHAR = 0x120;
public const int WM_MOUSEMOVE = 0x200;
public const int WM_LBUTTONDOWN = 0x201;
public const int WM_MOUSELAST = 0x20a;
public const int WM_USER = 0x0400;
public const int WM_REFLECT = WM_USER + 0x1c00;
public const int NM_CUSTOMDRAW = -12;
public const int TTN_NEEDTEXTA = ((0 - 520) - 0);
public const int TTN_NEEDTEXTW = ((0 - 520) - 10);
public const int TBN_QUERYINSERT = ((0 - 700) - 6);
public const int TBN_DROPDOWN = ((0 - 700) - 10);
public const int TBN_HOTITEMCHANGE = ((0 - 700) - 13);
public const int TBIF_IMAGE = 0x1;
public const int TBIF_TEXT = 0x2;
public const int TBIF_STATE = 0x4;
public const int TBIF_STYLE = 0x8;
public const int TBIF_COMMAND = 0x20;
public const int TBIF_SIZE = 0x40;
public const int MNC_EXECUTE = 2;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal class INITCOMMONCONTROLSEX
{
public int Size = 8;
public int Flags;
}
public const int ICC_BAR_CLASSES = 4;
public const int ICC_COOL_CLASSES = 0x400;
[DllImport("comctl32.dll")]
public static extern bool InitCommonControlsEx(INITCOMMONCONTROLSEX icc);
[StructLayout(LayoutKind.Sequential)]
internal struct POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential)]
internal struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential)]
internal struct NMHDR
{
public IntPtr hwndFrom;
public int idFrom;
public int code;
}
[StructLayout(LayoutKind.Sequential)]
internal struct NMTOOLBAR
{
public NMHDR hdr;
public int iItem;
public TBBUTTON tbButton;
public int cchText;
public IntPtr pszText;
}
[StructLayout(LayoutKind.Sequential)]
internal struct NMCUSTOMDRAW
{
public NMHDR hdr;
public int dwDrawStage;
public IntPtr hdc;
public RECT rc;
public int dwItemSpec;
public int uItemState;
public int lItemlParam;
}
[StructLayout(LayoutKind.Sequential)]
internal struct LPNMTBCUSTOMDRAW
{
public NMCUSTOMDRAW nmcd;
public IntPtr hbrMonoDither;
public IntPtr hbrLines;
public IntPtr hpenLines;
public int clrText;
public int clrMark;
public int clrTextHighlight;
public int clrBtnFace;
public int clrBtnHighlight;
public int clrHighlightHotTrack;
public RECT rcText;
public int nStringBkMode;
public int nHLStringBkMode;
}
public const int TTF_RTLREADING = 0x0004;
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
internal struct TOOLTIPTEXT
{
public NMHDR hdr;
public IntPtr lpszText;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=80)]
public string szText;
public IntPtr hinst;
public int uFlags;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
internal struct TOOLTIPTEXTA
{
public NMHDR hdr;
public IntPtr lpszText;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=80)]
public string szText;
public IntPtr hinst;
public int uFlags;
}
public const int TB_PRESSBUTTON = WM_USER + 3;
public const int TB_INSERTBUTTON = WM_USER + 21;
public const int TB_DELETEBUTTON = WM_USER + 22;
public const int TB_BUTTONCOUNT = WM_USER + 24;
public const int TB_GETITEMRECT = WM_USER + 29;
public const int TB_BUTTONSTRUCTSIZE = WM_USER + 30;
public const int TB_SETBUTTONSIZE = WM_USER + 32;
public const int TB_SETIMAGELIST = WM_USER + 48;
public const int TB_GETRECT = WM_USER + 51;
public const int TB_SETBUTTONINFO = WM_USER + 64;
public const int TB_HITTEST = WM_USER + 69;
public const int TB_GETHOTITEM = WM_USER + 71;
public const int TB_SETHOTITEM = WM_USER + 72;
public const int TB_SETEXTENDEDSTYLE = WM_USER + 84;
public const int TBSTATE_CHECKED = 0x01;
public const int TBSTATE_ENABLED = 0x04;
public const int TBSTATE_HIDDEN = 0x08;
public const int BTNS_BUTTON = 0;
public const int BTNS_SEP = 0x1;
public const int BTNS_DROPDOWN = 0x8;
public const int BTNS_AUTOSIZE = 0x10;
public const int BTNS_WHOLEDROPDOWN = 0x80;
[StructLayout(LayoutKind.Sequential, Pack=1)]
internal struct TBBUTTON
{
public int iBitmap;
public int idCommand;
public byte fsState;
public byte fsStyle;
public byte bReserved0;
public byte bReserved1;
public int dwData;
public int iString;
}
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
internal struct TBBUTTONINFO
{
public int cbSize;
public int dwMask;
public int idCommand;
public int iImage;
public byte fsState;
public byte fsStyle;
public short cx;
public IntPtr lParam;
public IntPtr pszText;
public int cchText;
}
[DllImport("user32.dll", ExactSpelling=true, CharSet=CharSet.Auto)]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -