using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices;namespace 准心 { public partial class Form1 : Form { bool mousemove = true; private Point mouseOffset; Color col = Color.FromArgb(0, 255, 255, 255);
private bool isMouseDown = false;
[DllImport("user32.dll", EntryPoint = "SetWindowPos")] public static extern int SetWindowPos( IntPtr hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags ); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { pictureBox1.BackColor = col; pictureBox1.BackgroundImage = imageList1.Images[0]; SetWindowPos(this.Handle, -1, Screen.PrimaryScreen.Bounds.Width / 2, Screen.PrimaryScreen.Bounds.Height / 2, this.Width, this.Height, 0); } private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { int xOffset; int yOffset; if (e.Button == MouseButtons.Left) { xOffset =-e.X ; yOffset = -e.Y - SystemInformation.FrameBorderSize.Height; mouseOffset = new Point(xOffset, yOffset); isMouseDown = true; } } private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (isMouseDown) { Point mousePos = Control.MousePosition; mousePos.Offset(mouseOffset.X, mouseOffset.Y); if (mousemove ) Location = mousePos;
lz是想画个准心同时也不影响玩游戏。屏幕内容是不停变化的,肯定不能直接用gdi画图。只有窗体穿透才是最佳选择了。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;namespace 准心
{
public partial class Form1 : Form
{
bool mousemove = true;
private Point mouseOffset;
Color col = Color.FromArgb(0, 255, 255, 255);
private bool isMouseDown = false;
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern int SetWindowPos(
IntPtr hwnd,
int hWndInsertAfter,
int x,
int y,
int cx,
int cy,
int wFlags
);
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.BackColor = col;
pictureBox1.BackgroundImage = imageList1.Images[0];
SetWindowPos(this.Handle, -1, Screen.PrimaryScreen.Bounds.Width / 2, Screen.PrimaryScreen.Bounds.Height / 2, this.Width, this.Height, 0);
} private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
int xOffset;
int yOffset; if (e.Button == MouseButtons.Left)
{
xOffset =-e.X ; yOffset = -e.Y - SystemInformation.FrameBorderSize.Height;
mouseOffset = new Point(xOffset, yOffset); isMouseDown = true;
}
} private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (isMouseDown)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(mouseOffset.X, mouseOffset.Y);
if (mousemove )
Location = mousePos;
} } private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isMouseDown = false;
} } private void 移动ToolStripMenuItem_Click(object sender, EventArgs e)
{
mousemove = true;
锁定ToolStripMenuItem.Visible = true;
移动ToolStripMenuItem.Visible = false;
} private void 锁定ToolStripMenuItem_Click(object sender, EventArgs e)
{
mousemove = false;
锁定ToolStripMenuItem.Visible = false;
移动ToolStripMenuItem.Visible = true ;
} private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
} }
}
我做好的:试试?
下载:
http://www.jsharer.com/blog/339525.htm
你要在游戏里面画出来 只有HOOK DX函数 自己绘制一个出来,没有其他办法
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication6
{
public partial class from : Form
{
int i = 0;
public from()
{
InitializeComponent();
}
public void show()
{
int height = (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height)/2;
int width = (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width)/2;
ControlPaint.DrawReversibleFrame(new Rectangle(width, height, 5, 5), Color.FromArgb(0, 255, 255), FrameStyle.Thick); } private void button1_Click(object sender, EventArgs e)
{
i++;
if (i % 2 != 0)
{
timer1.Enabled = true;
btn.Text = "关 闭";
}
else
{
timer1.Enabled = false;
btn.Text = "开 始";
} } private void timer1_Tick(object sender, EventArgs e)
{
show();
} private void from_Load(object sender, EventArgs e)
{
timer1.Enabled = false;
}
}
}