文章分类 - 系统
摘要:经常可以看到这样的程序,点了关闭按扭后程序并没有关闭,而是最小化到了系统拖盘处,就像网易泡泡,MSN之类的程序。实现这个其实很简单,捕捉窗体关闭时的消息就可以了。代码如下:protected override void WndProc(ref Message m){const int WM_SYSCOMMAND = 0x0112;const int SC_CLOSE = 0xF060;if (m....
阅读全文
摘要:原来一直是为每个文本框的KeyPress增加: if(e.KeyChar = '\r') SendKeys.Send("{TAB}");最近想想,其实有更简单的方法,把Form的KeyPreView设为true,然后在Form的KeyPress中增加下列代码即可: if (e.KeyChar == '\r') this.SelectNextControl(this.ActiveControl, t...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Microsoft.Win32;namespace Reg4U{ pub...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Text;using System.Diagnostics;namespace Log{class LogWirter{/// <summary>/// 事件源名称/// </summary>private string eventSourceName;Ev...
阅读全文
摘要:Microsoft.Win32.RegistryKeykey=Microsoft.Win32.Registry.CurrentUser; Microsoft.Win32.RegistryKeykey1=key.CreateSubKey"Software\Microsoft\Windows\CurrentVersion\Policies\System");key1.SetValue("Disable...
阅读全文
摘要:private ManagementClass mc; private ManagementObjectCollection moc; private ManagementObject disk; public run() {}================================= /// 取得设备网卡的MAC地址 public string GetNetCardMacAddress(...
阅读全文
摘要:如何获取系统中所有的输入法,以及如何根据输入语言及其他特殊要求选择特定的输入法,下面我以两段程序片断再加以说明。1)遍历系统中所有的输入法,可以用以下程序片断:foreach(InputLanguage lang in InputLanguage.InstalledInputLanguages){ this.textBox1.Text += "\r\nName> "+lang.LayoutN...
阅读全文
摘要:一、截取系统消息方法一://添加监视消息private void Form_Load(object sender, System.EventArgs e){ Application.AddMessageFilter(this);}//撤消消息监视private void Form_Closing(object sender, System.ComponentModel.CancelEventAr...
阅读全文
摘要:mciSendString函数可以打开或关闭光驱,只需简单的调用: mciSendString ("set cdaudio door open","",0,0);//打开光驱 mciSendString ("set cdaudio door closed","",0,0);//关闭光驱 using System;using System.Collections.Generic;using Sy...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;//读写文件的名空间using System.IO;namespace 加载整个硬盘...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 显示桌面{ public partial class Form1...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;//添加名空间using System.Diagnostics;namespace ...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;//using System.Globalization;namespace 列举语...
阅读全文
摘要: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;using...
阅读全文
摘要:相关的资料我在Google上搜索了一下,好像找不到详细一点的中文资料,只好跑到国外的网站学习了一下,做了一个类似资源管理器功能的菜单,如下图所示。在这里总结下做带图标菜单的经验,让大家少走些弯路。 首先我从MenuItem继承,编写了一个自己的MenuItem类,在构造函数中将OwnerDraw属性设置为true 如果没有设置这个属性MenuItem的OnDrawItem事件将不会被执行,不信可...
阅读全文
摘要:当我们在Windows XP下拷贝文件、删除文件、搜索文件等操作时,屏幕都会显示一个附带动画的操作进度对话框。从Win32编程时代一路走过来的朋友或者现在使用MFC进行开发的朋友对如何实现它想必都不会陌生。但是,我们现在已经在.Net C#平台下展开了全面的开发,那如何让C#程序也能实现显示一段Windows XP系统自带的动画资源呢?嘿嘿,.Net框架可不是白菜,通过使用PInvoke调用,我们...
阅读全文

浙公网安备 33010602011771号