摘要:
using System;using System.Runtime.InteropServices;using System.Text;namespace Sunmast.Hardware{ [Serializable] public struct HardDiskInfo { /// /// 型号 /// public... 阅读全文
摘要:
在窗体中加入如下代码 private static 窗体 instance = null;//添加一个属性public static 窗体 Instance{ set{ } get{ if(instance == null){ new 窗体(); } return instance; }} 在窗... 阅读全文
摘要:
WinForm: public string GetMD5(string str){ byte[] b = System.Text.Encoding.Default.GetBytes(str); b = new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(b); StringBuilder... 阅读全文
摘要:
添加引用 using System;using System.Text;using System.Security.Cryptography;using System.IO; //默认密钥向量private static byte[] Keys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };/// /// DES加密字符串/// ///... 阅读全文
摘要:
新建一个工程,在工具箱上单击右键,选择"添加/移除项",在com组件列表中选择Shockwave Flash Object,然后确定,加载Flash控件到工具箱选择工具箱上的Flash控件,放到窗体上并调整好大小在Form_Load()中加入如下代码 axShockwaveFlash1.Movie =@"D:\menu.swf"; //这里一定要写绝对地址axShockwaveFlash1.Men... 阅读全文
摘要:
添加引用 using System.Reflection;using System.Runtime.InteropServices;using System.Diagnostics; 调用DLL文件 [DllImport("User32.dll")]private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);[DllIm... 阅读全文
摘要:
在Form_Load中输入如下代码: foreach(Control ctrl in this.Controls) { if ((ctrl is TextBox) || (ctrl is ComboBox)) //如果文本框或下拉框放在组合框中,你应该用如groupBox1.TextBox { ctrl.KeyDown += new System.Windows.F... 阅读全文
摘要:
在窗体的类中声明两个变量 private Point mouseOffset; //记录鼠标指针的坐标private bool isMouseDown = false; //记录鼠标按键是否按下 创建该窗体 MouseDown事件的相应处理程序,注示部分为坐标的补偿 private void Form1_MouseDown(object sender, System.Windows.Forms.M... 阅读全文
摘要:
C#系统热键类 using System;using System.Runtime.InteropServices;namespace SystemHotKey{ public delegate void HotkeyEventHandler(int HotKeyID); public class Hotkey : System.Windows.Forms.IMessageFilter... 阅读全文
摘要:
using System; using System.IO; using System.Runtime.InteropServices; using System.Text;namespace OperateIni{ public class IniFile { private string IniFileName; [DllImport("kernel32")] private ... 阅读全文