代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices;
/* * 作者:Billy Qing * 日期:2009年11月20日 * 说明:EyesBaby Windows 前景窗口。 * 版本:1.0 */ namespace EyesBaby { public partial class WinScreenAdjust : Form { /* * 下面这段代码主要用来调用Windows API实现窗体透明(鼠标可以穿透窗体) * 也是从网上找的:) */ [DllImport("user32.dll", EntryPoint = "GetWindowLong")] public static extern long GetWindowLong(IntPtr hwnd, int nIndex); [DllImport("user32.dll", EntryPoint = "SetWindowLong")] public static extern long SetWindowLong(IntPtr hwnd, int nIndex, long dwNewLong); [DllImport("user32", EntryPoint = "SetLayeredWindowAttributes")] PRivate static extern int SetLayeredWindowAttributes(IntPtr Handle, int crKey, byte bAlpha, int dwFlags); const int GWL_EXSTYLE = -20; const int WS_EX_TRANSPARENT = 0x20; const int WS_EX_LAYERED = 0x80000; const int LWA_ALPHA = 2; public WinScreenAdjust() { InitializeComponent(); }