随笔分类 -  C#

摘要:基础信息 1、MenuItem 样式 <Window.Resources> <Style TargetType="{x:Type MenuItem}"> <!--<Setter Property="Background" Value="#999999" />--> <!--<Setter Prope 阅读全文
posted @ 2016-04-20 11:07 慧由心生 阅读(10199) 评论(1) 推荐(1)
摘要:1、如何设置winform窗体透明,但是显示的内容不透明? 方法:BackColor设置:Red(任意)在窗体属性里设置一个“TransparenceKey”的属性为Red 2、如何让C#编译不安全代码(含unsafe的代码) 方法:在“项目” 属性设置界面,找到“生成”选项卡下的“允许不安全代码” 阅读全文
posted @ 2016-04-18 14:42 慧由心生 阅读(386) 评论(0) 推荐(0)
摘要:8、错误 C2440: “static_cast”: 无法从“void (__thiscall CView::* )(UINT,LONG)”转换为“LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)” 问题 原因:VC6.0的消息映射函数方法,升级至VS2005 阅读全文
posted @ 2016-01-14 17:12 慧由心生 阅读(703) 评论(0) 推荐(0)
摘要:public class Path_File { public string AppPath { get { return AppDomain.CurrentDomain.BaseDirectory; } } public Path_File() { } /// <summary> /// 查找指定 阅读全文
posted @ 2016-01-13 19:08 慧由心生 阅读(1698) 评论(2) 推荐(0)
摘要:public class DomainHelper { public static void SetDomainValue(string key, object password) { AppDomain.CurrentDomain.SetDa... 阅读全文
posted @ 2015-12-28 09:42 慧由心生 阅读(250) 评论(0) 推荐(0)
摘要:/// /// 文件名唯一(A.txt => An.txt) /// /// 文件名 /// private string SingleFullName(string fullName) { ... 阅读全文
posted @ 2015-12-21 17:44 慧由心生 阅读(306) 评论(0) 推荐(0)
摘要:public class WindowsIdentityHelper { private static ILog _logger = LogManager.GetLogger("WindowsIdentityHelper"); /// ///... 阅读全文
posted @ 2015-11-20 18:13 慧由心生 阅读(450) 评论(0) 推荐(0)
摘要:Windows驱动开发一、前言依据《Windows内核安全与驱动开发》及MSDN等网络质料进行学习开发。二、初步环境1、下载安装WDK7.1.0(WinDDK\7600.16385.1)地址:https://msdn.microsoft.com/en-us/windows/hardware/hh85... 阅读全文
posted @ 2015-11-08 19:57 慧由心生 阅读(11450) 评论(0) 推荐(0)
摘要:1、获取Mac地址//WiFi通知回调 private WlanApi.WLAN_NOTIFICATION_CALLBACK _notificationCallback;this._notificationCallback = new WlanApi.WLAN_NOTIFICATION... 阅读全文
posted @ 2015-09-01 10:39 慧由心生 阅读(5616) 评论(0) 推荐(0)
摘要:1、将对象序列化为二进制值,供WebBrowser传值: private static byte[] PostDataToBytes(Data postData) { JavaScriptSerializer jsonSerializer = new... 阅读全文
posted @ 2015-08-27 10:26 慧由心生 阅读(537) 评论(0) 推荐(0)
摘要:一、直接写入文件 /// /// 将message的内容写入日志文件 /// /// public static void WriteLog(string msg) { string path = Ap... 阅读全文
posted @ 2015-08-26 18:48 慧由心生 阅读(456) 评论(0) 推荐(0)
摘要:一、通过系统事件1、实现如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threading;usi... 阅读全文
posted @ 2015-08-26 18:17 慧由心生 阅读(572) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;namespace MyWifi{ public class ListBoxLogs { p... 阅读全文
posted @ 2015-08-25 10:36 慧由心生 阅读(824) 评论(0) 推荐(0)
摘要:写的一个简单启动关闭WiFi的类:具体如下using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;namespace MyWifi{ public class WiFi ... 阅读全文
posted @ 2015-08-25 10:30 慧由心生 阅读(2426) 评论(0) 推荐(0)
摘要:1、向窗体上添加如下控件:MenuStrip menuStrip1, NotifyIcon ni_frmMain,Timer timer1, ContentMenuStrip cms_notify。其中notify中包含显示、退出等。2、实现的代码: #region 托盘相关代码 ... 阅读全文
posted @ 2015-08-13 10:16 慧由心生 阅读(1491) 评论(0) 推荐(0)
摘要:实现托盘(任务栏图标与托盘图标互斥),并且在点击任务栏图标时实现的最小化与点击最小化按钮分离。具体如下:1、向窗体上添加如下控件:MenuStrip menuStrip1, NotifyIcon ni_frmMain,Timer timer1, ContentMenuStrip cms_noti... 阅读全文
posted @ 2015-08-12 16:43 慧由心生 阅读(2143) 评论(0) 推荐(0)
摘要:通常点击任务栏上的图标时,对应窗体实现“最小化或者恢复”的效果。但是在做最小化到托盘时,不希望点击任务栏图标时最小化到托盘,即希望拦截了这些效果(不允许:通过点击任务栏上的图标,实现“最小化或者恢复”的效果);具体实现代码如下: #region 区别 任务栏中点击窗体图标(最小化|... 阅读全文
posted @ 2015-08-12 16:09 慧由心生 阅读(3263) 评论(0) 推荐(0)
摘要:控制WinForm界面在屏幕的四个角落显示,具体代码中有说明:using System;using System.Collections.Generic;using System.Drawing;using System.Linq;using System.Text;using System.Thr... 阅读全文
posted @ 2015-08-11 20:25 慧由心生 阅读(3012) 评论(0) 推荐(0)
摘要:1、DevExpress:引用其下的不同DLL,可操作使用不同的控件2、IrisSkin2:引用对应的DLL后,代码如下private Sunisoft.IrisSkin.SkinEngine skinEngine1;this.skinEngine1 = new Sunisoft.IrisSkin.... 阅读全文
posted @ 2015-08-11 15:21 慧由心生 阅读(594) 评论(0) 推荐(0)
摘要:JS与Web交互:http://www.docin.com/p-76710976.html一、WinForm的WebBrowser控件与JS交互数据: 1、C#类内的代码执行JS脚本函数: 给C#类中的WebBrowser控件加载一个包含JS脚本的HTML页面:this.webBrowser1.... 阅读全文
posted @ 2015-08-06 11:01 慧由心生 阅读(2217) 评论(0) 推荐(0)