04 2013 档案
摘要:看到这个特性时,以为能少声明内部字段,像以下代码那么写public class TestValue{ [DefaultValue(true)] public bool IsSame { get; set; }} 但其实测试过后,直接获取IsSame属性,并不是true,而且测试其他数据类型,也是一样 后来网上查了下,才发现之前的理解是错的,一下是MSDN的解释A DefaultValueAttribute will not cause a member to be automatically initialized with the at...
阅读全文
摘要:解决方法很简单,很扯淡,在Text的内容后面加三个空格
阅读全文
摘要:最近的系统使用到了多线程,发现一个问题在多线程弹出的提示窗体MessageBox,可能会因为用户点击等原因,根本注意不到,从而导致一些操作被忽略网上查了下,发现可以通过传入MessageBox的参数IWin32Window 来解决这个问题 MessageBox.Show(this, "请点击确定进行程序更新", "程序提示");其中,this代表一个窗体对象
阅读全文
摘要:使用以下代码即可实现 /// <summary> /// 显示提示消息 /// </summary> /// <param name="msg">需要显示的信息</param> public static void ShowMsg(System.Windows.Forms.IWin32Window window, string msg) { XtraMessageBoxForm form = new XtraMessageBoxForm(); form.Icon = ...
阅读全文
摘要:DevExpress的皮肤设置,只对创建他的线程生效。所以必须在多线程的方法中,手动添加设置 //皮肤设置只对创建他的线程生效,所以必须在线程方法中设置皮肤 DevExpress.UserSkins.BonusSkins.Register(); //主程序中未使用,可以注释掉这一句 if (!string.IsNullOrEmpty(skinName)) DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName =...
阅读全文
摘要:将窗体的属性AllowFormGlass设置为DefaultBoolean.False即可 this.AllowFormGlass = DefaultBoolean.False;
阅读全文
摘要:[DllImport("user32.dll")] public static extern bool PrintWindow( IntPtr hwnd, // Window to copy,Handle to the window that will be copied. IntPtr hdcBlt, // HDC to print into,Handle to the device context. UInt32 nFlags /...
阅读全文
摘要:private string[] GetFiles(string path) { List<string> lstFiles = new List<string>(); lstFiles.AddRange(Directory.GetFiles(path)); string[] dirs = Directory.GetDirectories(path); foreach (string dir in dirs) { try ...
阅读全文
摘要:在写入文件时,指定Encoding为ASCIIEncoding.Default就可以解决该问题如 File.WriteAllText("update.bat","taskkill /F /IM explorer.exe", ASCIIEncoding.Default); //创建批处理文件
阅读全文