1 Star 0 Fork 122

库卡青年/DevelopAssistant

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
NativeMethods.cs 4.50 KB
一键复制 编辑 原始数据 按行查看 历史
wxd_tony1984 提交于 2019-03-25 20:41 +08:00 . 添加公共控件
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
namespace ICSharpCode.WinFormsUI.Controls
{
internal class NativeMethods
{
internal const int WM_PAINT = 0xF;
internal const int VK_LBUTTON = 0x1;
internal const int VK_RBUTTON = 0x2;
internal const int SB_CTL = 2;
internal const int SIF_ALL = (0x0001 | 0x0002 | 0x0004 | 0x0010);
internal const int WHEEL_DELTA = 120;
// basically it's constant now, but could be changed later by MS
internal const int WHEEL_MAX_DELTA = 120;
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern bool GetScrollInfo(HandleRef hWnd, int fnBar, NativeMethods.Scrollinfo si);
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern int SetScrollInfo(HandleRef hWnd, int fnBar, NativeMethods.Scrollinfo si, bool redraw);
private const int TCM_FIRST = 0x1300;
public const int TCM_GETITEMRECT = (TCM_FIRST + 10);
public static readonly IntPtr TRUE = new IntPtr(1);
[StructLayout(LayoutKind.Sequential)]
public struct PAINTSTRUCT
{
internal IntPtr hdc;
internal int fErase;
internal RECT rcPaint;
internal int fRestore;
internal int fIncUpdate;
internal int Reserved1;
internal int Reserved2;
internal int Reserved3;
internal int Reserved4;
internal int Reserved5;
internal int Reserved6;
internal int Reserved7;
internal int Reserved8;
}
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
internal RECT(int X, int Y, int Width, int Height)
{
this.Left = X;
this.Top = Y;
this.Right = Width;
this.Bottom = Height;
}
internal int Left;
internal int Top;
internal int Right;
internal int Bottom;
}
[StructLayout(LayoutKind.Sequential)]
public class Scrollinfo
{
public int fMask;
public int nMin;
public int nMax;
public int nPage;
public int nPos;
public int cbSize;
public int nTrackPos;
public Scrollinfo()
{
cbSize = Marshal.SizeOf(typeof(Scrollinfo));
}
public Scrollinfo(int mask, int min, int max, int page, int pos) : this()
{
fMask = mask;
nMin = min;
nMax = max;
nPage = page;
nPos = pos;
}
}
[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(
IntPtr hwndParent,
IntPtr hwndChildAfter,
string lpszClass,
string lpszWindow);
[DllImport("user32.dll")]
public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
[DllImport("user32.dll")]
public static extern short GetKeyState(int nVirtKey);
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(
IntPtr hWnd, int Msg, int wParam, ref RECT lParam);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetCursorPos(ref Point lpPoint);
[DllImport("user32.dll")]
public extern static int OffsetRect(ref RECT lpRect, int x, int y);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool PtInRect([In] ref RECT lprc, Point pt);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetClientRect(IntPtr hWnd, ref RECT r);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern bool IsWindowVisible(IntPtr hwnd);
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr wnd,int msg,bool param,int lparam);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/wwwpythonpw/DevelopAssistant.git
git@gitee.com:wwwpythonpw/DevelopAssistant.git
wwwpythonpw
DevelopAssistant
DevelopAssistant
master

搜索帮助