基本信息
源码名称:C# 枪战通用物理外挂 源码
源码大小:0.07M
文件格式:.rar
开发语言:C#
更新时间:2018-01-07
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 5 元×
微信扫码支付:5 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
使用方法通读代码后就会使用了,自己摸索也可以!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace 枪战类通用物理外挂 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } int bs=2;//倍数 [DllImport("user32.dll")]//取设备场景 private static extern IntPtr GetDC(IntPtr hwnd);//返回设备场景句柄 [DllImport("gdi32.dll")]//取指定点颜色 private static extern int GetPixel(IntPtr hdc, Point p); [DllImport("user32.dll", EntryPoint = "FindWindowA")] public static extern IntPtr FindWindowA(string lp1, string lp2); [DllImport("user32.dll", EntryPoint = "ShowWindow")] public static extern IntPtr ShowWindow(IntPtr hWnd, int _value); //重写API函数 [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "ShowCursor")] public extern static bool ShowCursor(bool bShow); private void Form1_Load(object sender, EventArgs e) { TransparencyKey = BackColor; } int bj; private void timer1_Tick(object sender, EventArgs e) { Point p = new Point(MousePosition.X, MousePosition.Y);//取置顶点坐标 IntPtr hdc = GetDC(new IntPtr(0));//取到设备场景(0就是全屏的设备场景) int bj = GetPixel(hdc, p);//取指定点颜色 int r = (bj & 0xFF);//转换R int g = (bj & 0xFF00) / 256;//转换G int b = (bj & 0xFF0000) / 65536;//转换B pictureBox2.BackColor = Color.FromArgb(r, g, b);//设置颜色框 } private void button3_Click(object sender, EventArgs e) { timer1.Start(); if (KG == true) { KG = false; } else { KG = true; } } private void button3_KeyDown(object sender, KeyEventArgs e) { if(e.KeyCode==Keys.T) { timer1.Stop(); } } private void timer2_Tick(object sender, EventArgs e) { Point p = new Point(MousePosition.X, MousePosition.Y);//取置顶点坐标 label1.Text = "当前鼠标坐标:" "X:" p.X "Y:" p.Y;//把坐标显示到窗口上 my = p.Y; mx = p.X; } private void button4_Click(object sender, EventArgs e) { timer2.Start(); } private void button4_KeyDown(object sender, KeyEventArgs e) { timer2.Stop(); } //放大图片 public Bitmap Magnifier(Bitmap srcbitmap, int multiple) { try { if (multiple <= 0) { multiple = 0; return srcbitmap; } Bitmap bitmap = new Bitmap(srcbitmap.Size.Width * multiple, srcbitmap.Size.Height * multiple); BitmapData srcbitmapdata = srcbitmap.LockBits(new Rectangle(new Point(0, 0), srcbitmap.Size), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); BitmapData bitmapdata = bitmap.LockBits(new Rectangle(new Point(0, 0), bitmap.Size), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); unsafe { byte* srcbyte = (byte*)(srcbitmapdata.Scan0.ToPointer()); byte* sourcebyte = (byte*)(bitmapdata.Scan0.ToPointer()); for (int y = 0; y < bitmapdata.Height; y ) { for (int x = 0; x < bitmapdata.Width; x ) { long index = (x / multiple) * 4 (y / multiple) * srcbitmapdata.Stride; sourcebyte[0] = srcbyte[index]; sourcebyte[1] = srcbyte[index 1]; sourcebyte[2] = srcbyte[index 2]; sourcebyte[3] = srcbyte[index 3]; sourcebyte = 4; } } } srcbitmap.UnlockBits(srcbitmapdata); bitmap.UnlockBits(bitmapdata); return bitmap; } catch { this.Close(); return null; } } private void button1_Click(object sender, EventArgs e) { timer3.Start(); } int screenWidth; //屏幕宽度 int screenHeight; //屏幕高度 int mx; //鼠标x坐标 int my; //鼠标y坐标 const int imgWidth = 181;//放大后图片的宽度 const int imgHeight = 181;//放大后图片的高度 public double ColorSub(Color Color1, Color Color2) { double temp = Math.Pow((Color1.R - Color2.R), 2) Math.Pow((Color1.G - Color2.G), 2) Math.Pow((Color1.B - Color2.B), 2); return temp; } Graphics g; bool KG=false ; private void timer3_Tick(object sender, EventArgs e) { Bitmap image; Size size = new Size(imgWidth, imgHeight); image = new Bitmap(size.Width, size.Height); g = Graphics.FromImage(image); g.CopyFromScreen(new Point(mx - (imgWidth / 4), my - (imgHeight / 4)), new Point(0, 0), size); g.Dispose(); pictureBox1.Image = Magnifier(image, bs); image.Dispose(); Point p = new Point(mx, my);//取置顶点坐标 IntPtr hdc = GetDC(new IntPtr(0));//取到设备场景(0就是全屏的设备场景) int k = GetPixel(hdc, p);//取指定点颜色 int r = (k & 0xFF);//转换R int g2 = (k & 0xFF00) / 256;//转换G int b = (k & 0xFF0000) / 65536;//转换B pictureBox3.BackColor = Color.FromArgb(r, g2, b);//设置颜色框 double l = ColorSub(pictureBox2.BackColor, pictureBox3.BackColor); if (l < 1000 && KG==true) { Console.Beep(800, 300); } GC.Collect(); GC.WaitForPendingFinalizers(); } //获取任务栏 IntPtr hTray = Form1.FindWindowA("Shell_TrayWnd", String.Empty); private void button2_Click(object sender, EventArgs e) { bs = 2; } private void pictureBox1_Click(object sender, EventArgs e) { if(TopMost==false) { TopMost = true; //隐藏任务栏 Form1.ShowWindow(hTray, 0); //隐藏除图片框外所有空间 button1.Visible = false; button2.Visible = false; button3.Visible = false; button4.Visible = false; button5.Visible = false; pictureBox2.Visible = false; pictureBox3.Visible = false; ShowCursor(false);//鼠标隐藏 label1.Visible = false; FormBorderStyle = FormBorderStyle.None; } else { //显示任务栏 Form1.ShowWindow(hTray, 5); //显示除图片框外所有空间 button1.Visible = true; button2.Visible = true; button3.Visible = true; button4.Visible = true; button5.Visible = true; label1.Visible = false; ShowCursor(true);//鼠标显示 pictureBox2.Visible = true; pictureBox3.Visible = true; TopMost = false; FormBorderStyle = FormBorderStyle.FixedToolWindow; } } private void button5_Click(object sender, EventArgs e) { bs = 4; } } }