摘要: 字体的安装需要调用到系统的api [DllImport("kernel32.dll", SetLastError = true)] static extern int WriteProfileString(string lpszSection, string lpszKeyName, string lpszString); [DllImport("user32.dll")] public static extern int SendMessage(int hWnd,uint msg,int wParam, int lParam); ... 阅读全文
posted @ 2014-04-04 11:22 Alf7 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1. 有一个专门的类用于监视文件夹变动FileSystemWatcher 设置该对象相关属性。 注:不能同事监视多种扩展名的文件对象,如果需要监视多种类型的文件的话需要定义多个对象分别实现 _ttfWatcher.Path = titleFolderSelection.Path; _ttfWatcher.Filter = "*.ttf"; _ttfWatcher.Changed += OnProcess; _ttfWatcher.Created += OnProcess; _ttfW... 阅读全文
posted @ 2014-04-04 11:20 Alf7 阅读(226) 评论(0) 推荐(0) 编辑
摘要: /// /// 文件加密 /// /// 文件路径 /// 保存路径 /// 密钥 public static void encryptFile(string filePath, string savePath, string keyStr) { //通过des加密 var des = new DESCryptoServiceProvider(); //通过流打开文件 var fs = Fi... 阅读全文
posted @ 2014-04-03 14:14 Alf7 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 1. 定义需要的resource文件1.1 从网上down的一个滑块checkBox 1.2 用于绑定对象的listbox的DataTemplate 2. 调用时利用ResourceDictionary.MergedDictionaries ... 阅读全文
posted @ 2014-03-24 17:24 Alf7 阅读(1123) 评论(0) 推荐(0) 编辑
摘要: Got a project which is target on camera and microphone control on the computer. While looking for the related materials like AForge.Net, DirectX.Capture, OMCS and so on. Here are some thoughts based on that: 阅读全文
posted @ 2014-03-21 10:40 Alf7 阅读(739) 评论(0) 推荐(0) 编辑
摘要: WPF中的图片显示主要使用Image控件。当new出一个bitmapImage作为Image的source时,如果文件过大会十分影响加载速度,因此采用其缩略图 using (System.Drawing.Image drawingImage = System.Drawing.Image.FromFile(filePath)) //创建image对象 { using (System.Drawing.Image thumbImage = drawingImage.GetThumbnailIm... 阅读全文
posted @ 2014-03-07 16:09 Alf7 阅读(621) 评论(0) 推荐(0) 编辑
摘要: 当后台执行大量程序的时候,前端需要有一个progressBar来显示进度,但是当后台在执行的时候会导致前台页面的卡死,以下在前台实现变动。1. 声明一个委托并实例化 private delegate void UpdateUiDelegate(DependencyProperty dp, Object value); private readonly UpdateUiDelegate _updateTextDelegateDelegate; private readonly UpdateUiDelegate _updateProgressDelegat... 阅读全文
posted @ 2014-03-05 17:06 Alf7 阅读(753) 评论(0) 推荐(0) 编辑
摘要: 1.在类内部声明两个API函数 [DllImport("user32.dll")] //在类内部声明两个API函数 public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint control, Keys keys); [DllImport("user32.dll")] //在类内部声明两个API函数 public static extern bool UnregisterHotKey(IntPtr hWnd, int id); public stati... 阅读全文
posted @ 2014-03-02 17:38 Alf7 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 1. 启动时设置初始状态、图标对象2. 定义双击事件3. 定义最小化事件 WindowState _wsl; //状态保存 NotifyIcon _notifyIcon; //图标对象 private void icon() { _notifyIcon = new NotifyIcon(); _notifyIcon.BalloonTipText = Properties.Resources.MainWindow_icon_Alf7_ScreenCaptu... 阅读全文
posted @ 2014-03-02 16:38 Alf7 阅读(388) 评论(0) 推荐(0) 编辑
摘要: 1. 开发版本与部署版本不一致 描述:无法识别的属性“targetFramework” 原因:开发是用的.net 4.0,部署时应用池是.net 2.0 处理:修改应用池为.net 4.02. .net 没有被注册到iis中 描述:理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipelineHandler” 原因:先安装的.net, 后安装的iis 处理:在.net目录下运行 aspnet_iis 阅读全文
posted @ 2014-03-02 16:30 Alf7 阅读(185) 评论(0) 推荐(0) 编辑