⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colorkeys.cs

📁 外挂程序
💻 CS
字号:
#region  严重声明
//此程序开源,仅为经验交流用。
//请勿做出违法的程序
//如有做出违法行为,本人不负责任何法律责任。
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using board.Library;

namespace board.GetColors
{
    class ColorKeys
    {
        [DllImport("gdi32.dll")]
        private static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);

        [DllImport("gdi32.dll")]
        private static extern IntPtr CreateDC(string lpszDriver, string lpszDevice, string lpszOutput, IntPtr lpInitData);

        public Color GetColorCode(int x, int y)
        {
            IntPtr hdlDisplay = CreateDC("DISPLAY", null, null, IntPtr.Zero);
            Graphics gfxDisplay = Graphics.FromHdc(hdlDisplay);
            Bitmap bmp = new Bitmap(1, 1, gfxDisplay);
            Graphics gfxBmp = Graphics.FromImage(bmp);
            IntPtr hdlScreen = gfxDisplay.GetHdc();
            IntPtr hdlBmp = gfxBmp.GetHdc();
            BitBlt(hdlBmp, 0, 0, 1, 1, hdlScreen, x, y, 13369376);
            gfxDisplay.ReleaseHdc(hdlScreen);
            gfxBmp.ReleaseHdc(hdlBmp);
            Color color = Color.FromArgb(bmp.GetPixel(0, 0).R, bmp.GetPixel(0, 0).G, bmp.GetPixel(0, 0).B);
            gfxDisplay.Dispose();
            gfxBmp.Dispose();
            bmp.Dispose();
            return color;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -