随笔分类 - C#
摘要:动态添加dll string callingDomainName = AppDomain.CurrentDomain.FriendlyName; AppDomain ad = AppDomain.CreateDomain("DLL Unload test"); ProxyObject obj = (
阅读全文
摘要:using System;using System.IO;using System.Data;using System.Text;using System.Diagnostics;using System.Security;using System.Security.Cryptography;/* ...
阅读全文
摘要:代码页名称显示名称37IBM037IBM EBCDIC(美国 - 加拿大)437IBM437OEM 美国500IBM500IBM EBCDIC(国际)708ASMO-708阿拉伯字符 (ASMO 708)720DOS-720阿拉伯字符 (DOS)737ibm737希腊字符 (DOS)775ibm77...
阅读全文
摘要:一般情况下,按enter跳到下一控件private void txtFindText_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) SendKeys.Send("{TAB}"); }private void...
阅读全文
摘要:发送邮箱要支持smtp PS:QQ邮箱必须设置独立密码才能开启smtp 利用outlook发送邮件 outlook必须处于打开状态,如果发送不带附件的邮件需要加mailItem.Display(),带附件不需要加,outlook2010下测试,版本为14
阅读全文
摘要:IEnumerable接口和IEnumerator接口区别1. 简单来说IEnumerable是一个声明式的接口,声明实现该接口的类就是“可迭代的enumerable”,但并没用说明如何实现迭代器(iterator).其代码实现为: public interface IEnumerable { IE...
阅读全文
摘要:可以通过调用API函数将关闭按钮灰化(不可用) [DllImport("user32")] public static extern IntPtr GetSystemMenu(IntPtr hwnd, int bRevert); [DllImport("user32")] public static...
阅读全文
摘要:应用程序启动与关闭事件 Form 和 Control 类和应用程序启动与关闭有关的时间。 当 Windows Form 应用程序启动时,会以下列顺序引发主要表单的启动事件: System.Windows.Forms.Control.HandleCreated System.Windows.Forms.Control.BindingContextChanged System.Windows.Forms.Form.Load System.Windows.Forms.Control.VisibleChanged System.Windows.Forms.Form.Activated System.W
阅读全文
摘要:using System.Runtime.InteropServices;[DllImport("User32.dll")]public static extern void keybd_event(Byte bVk,Byte bScan,Int32 dwFlags,Int32 dwExtraInfo);private void button1_Click(object sender, System.EventArgs e){keybd_event(0x5b, 0, 0, 0); //0x5b是left win的代码,这一句使key按下,下一句使key释放。keybd_ev
阅读全文
摘要:一、获取当前文件的路径1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName 获取模块的完整路径,包括文件名。2. System.Environment.CurrentDirectory 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。3. System.IO.Directory.GetCurrentDirectory() 获取应用程序的当前工作目录。这个不一定是程序从中启动的目录啊,有可能程序放在C:/www里,这个函数有可能返回C:/Documents and Settings/ZYB/,或者C:
阅读全文