- 博客(21)
- 资源 (7)
- 收藏
- 关注
原创 c# winform实现windows7毛玻璃效果 张宇轩
既然是系统API,当然就不只是WPF专用了。拆开了GlassHelper,主要内容就是两个PInvoke签名:DwmExtendFrameIntoClientArea控制窗体的玻璃效果,DwmIsCompositionEnabled检测系统的桌面组合功能是否打开。MARGINS是DwmExtendFrameIntoClintArea需要的参数结构,表达的是窗口四周的边框。实现全玻璃背景,其实就是将有玻璃效果的窗体边框向内扩展,当MARGINS足够大之后,就全变成玻璃状态了。PInvoke签名
2010-09-02 08:24:00
5022
1
原创 c# 鼠标拖动控件 张宇轩
<br />private bool isMouseDown = false;<br />private Point mouseOffset; //记录鼠标指针的坐标<br /> <br />private void pictureBox1_MouseDown(object sender, MouseEventArgs e)<br /> {<br /> if (e.Button == MouseButtons.Left)<br /> {<br />
2010-09-01 11:56:00
679
原创 c# 改变无边框窗体大小 张宇轩
#region 改变窗体大小 const int WM_NCHITTEST = 0x0084; const int HTLEFT = 10; //左边界 const int HTRIGHT = 11; //右边界 const int HTTOP = 12; //上边界 const int HTTOPLEFT = 13; //左上角 const int HTTOPRIGHT = 14; //右上角
2010-09-01 11:52:00
906
原创 c# 安装局部鼠标钩子 张宇轩
<br />#region 安装局部鼠标钩子 开始调用InstallHook() 并在load事件中加载 OnMouseActivity += new MouseEventHandler(hook_MainMouseMove);//添加鼠标钩子事件<br /> //安装钩子 <br /> [DllImport("user32.dll", CallingConvention = CallingConvention.StdCall)]<br /> public stat
2010-08-31 09:04:00
1751
原创 c# 屏蔽任务管理器 张宇轩
<br />public void TaskmgrHide()<br /> {<br /> Process[] proc = Process.GetProcesses();<br /> foreach (Process thisproc in proc)<br /> {<br /> if (thisproc.ProcessName.Equals("taskmgr"))<br />
2010-08-31 09:04:00
657
原创 c# 读写INI配置文件 张宇轩
<br />[DllImport("kernel32")]//****************写INI文件<br /> public static extern long WritePrivateProfileString(string section, string key, string val, string filePath);<br /> [DllImport("kernel32")]//****************读INI文件<br /> publi
2010-08-31 09:02:00
348
原创 c# 鼠标穿透窗体 张宇轩
<br />private const uint WS_EX_LAYERED = 0x80000;<br /> private const int WS_EX_TRANSPARENT = 0x20;<br /> private const int GWL_STYLE = (-16);<br /> private const int GWL_EXSTYLE = (-20);<br /> private const int LWA_ALPHA = 0x2;
2010-08-31 09:01:00
581
原创 C# Base64 加密解密 张宇轩
<br />using System;<br />using System.Text;<br />namespace wgscd<br />{<br /> <br /> public sealed class Base64<br /> {<br /> /// <summary><br /> /// Base64加密<br /> /// </summary><br /> /// <param name="codeName">加密采用的编
2010-08-29 03:14:00
447
原创 C# 改变屏幕亮度 张宇轩
<br />using System;<br />using System.Text;<br />using System.Drawing;<br />using System.Runtime.InteropServices;<br />namespace wgscd<br />{<br /> public static class Win32<br /> {<br /> [DllImport("gdi32.dll")]<br /> private unsafe st
2010-08-29 03:12:00
1125
原创 c# 汉字转拼音类 张宇轩
<br />using System;<br />using System.Collections.Generic;<br />using System.Text;<br />using System.Text.RegularExpressions;<br />using System.Web;<br />namespace wgscd<br />{<br /> <br /> public class Common<br /> {<br /> /// <summary><br
2010-08-29 03:11:00
967
1
原创 c# 获得cpu序列号 硬盘序列号 MAC地址 张宇轩
<br />private void Form1_Load(object sender, EventArgs e)<br /> {<br /><br /> string[] s= GetPCinfo();<br /> foreach (string str in s)<br /> {<br /> richTextBox1.AppendText(str + "/r/n" );<br />
2010-08-29 03:10:00
425
原创 c# 模仿鼠标拖拽矩形框 张宇轩
private void ResizeToRectangle(Point p){ DrawRectangle(); MouseRect.Width = p.X - MouseRect.Left; MouseRect.Height = p.Y - MouseRect.Top; DrawRectangle();}private void DrawRectangle(){ Rectangle rect = this.RectangleToScreen(MouseRect); ControlPaint.
2010-08-28 09:36:00
2302
原创 c# 获取windows桌面图标 张宇轩
<br />using System.Runtime.InteropServices;<br /> public const uint LVM_FIRST = 0x1000;<br /> public const uint LVM_GETITEMCOUNT = LVM_FIRST + 4;<br /> public const uint LVM_GETITEMW = LVM_FIRST + 75;<br /> public const uint LVM_GETITE
2010-08-28 09:33:00
1444
原创 c# 加密解密算法 张宇轩
<br />1、方法一 (不可逆加密)<br /><br /> <br /><br /> <br /><br />public string EncryptPassword(string PasswordString,string PasswordFormat ) <br /> { <br /> string encryptPassword = null;<br /> if (PasswordFormat="SHA1"){ <br /> encryptPassword=FormsAutho
2010-08-28 09:29:00
413
原创 c# Windows消息列表 张宇轩
WM_ACTIVATE0x6The WM_ACTIVATE message is sent when a window is being activated or deactivated. This message is sent first to the window procedure of the top-level window being deactivated; it is then sent to the window procedure of the top-level window bei
2010-08-28 09:24:00
902
原创 c# 检测USB闪存插入 张宇轩
<br /> public const int WM_DEVICECHANGE = 0x219;//U盘插入后,OS的底层会自动检测到,然后向应用程序发送“硬件设备状态改变“的消息: WM_DEVICECHANGE = 0x219;如果你的程序,捕获了这个消息,并对其中的标志位进行判断,就可以知道是哪个硬件、发生了什么状态改变。<br /> public const int DBT_DEVICEARRIVAL = 0x8000;,就是用来表示U盘可用的。一个设备或媒体已被插入一块,现在可用。<
2010-08-28 09:22:00
2714
原创 c# 杀死桌面进程 张宇轩
一般我们通过Process.kill(); 来杀死的话 explorer会重新启动。 #region 杀死explorer进程 public void KillExplorer(){ Process[] proc = Process.GetProcesses(); foreach (Process thisproc in proc) { if (thisproc.ProcessName.Equals
2010-08-27 19:52:00
936
原创 c# 设置系统时间 张宇轩
#region 设置系统时间 [DllImport("kernel32.dll")] private static extern bool SetLocalTime(ref SYSTEMTIME time); [StructLayout(LayoutKind.Sequential)] private struct SYSTEMTIME { public short year; public s
2010-08-27 19:50:00
422
原创 c# 拖动无边框窗体 张宇轩
#region 拖动无边框窗体 [DllImport("user32.dll")]//*********************拖动无窗体的控件 public static extern bool ReleaseCapture(); [DllImport("user32.dll")] public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam
2010-08-27 19:48:00
446
原创 C# 实现图片旋转的代码 张宇轩
#region 图片旋转函数/// /// 以逆时针为方向对图像进行旋转/// /// 位图流/// 旋转角度[0,360](前台给的)/// public Bitmap Rotate(Bitmap b, int angle){angle = angle % 360; //弧度转换double radian = angle * Math.PI / 180.0;double cos = Math.Cos(radian);double sin = Math.Sin(radian);//原图的宽和高int w =
2010-08-27 19:32:00
955
原创 c# 模拟windows桌面鼠标拖选 张宇轩
命名空间 using System.Drawing; 定义两个变量 bool MouseIsDown=false; Rectangle MouseRect = Rectangle.Empty; 定义三个方法 privatevoid ResizeToRectangle(Point p) { DrawRectangle(); MouseRect.Width = p.X - MouseRect.Left; MouseRect.Height = p.Y - MouseRect.T
2010-08-27 19:31:00
1282
c# 进程防杀 张宇轩
2010-08-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人