文章分类 -  Winform

摘要:private void WindowShowHide() { if (this.WindowState == FormWindowState.Normal) { Point cursorPoint = new Point(Cursor.Position.X, Cursor.Position.Y); Rectangle rectgle = new Rectangle(this.Left, this.Top, this.Left + this.Width, this.Top + ... 阅读全文
posted @ 2012-02-15 16:42 戴眼镜的乌龟 阅读(1070) 评论(1) 推荐(0) 编辑
摘要:lvStartItems为listview控件#region 获取注册表名和值 private void GetStartItemsName() { RegistryKey regKey = Registry.LocalMachine; using (RegistryKey startKey = regKey.OpenSubKey(startString, true)) { string[] arrStartItems = startKey.GetValueNames()... 阅读全文
posted @ 2012-02-14 15:54 戴眼镜的乌龟 阅读(1706) 评论(0) 推荐(0) 编辑
摘要:方法一: 也是广为人知的一种: YourDataTable.Columns.Remove("列名"); 但是这种情况只适合于去掉很少列的情况。 如果有很多列我却只要一两列呢,那就得用方法二了。方法二: DataTable dat = YourDataTable.DefaultView.ToTable(false, new string[] { "你要的列名", "你要的列名" });补加dataTable操作相关内容:对DataTable的一些操作在dataTable中最容易想到的是用for循环来操作,但事实不到万不得已是不会用for 阅读全文
posted @ 2011-12-20 09:45 戴眼镜的乌龟 阅读(2780) 评论(0) 推荐(1) 编辑
摘要:staticvoid Main(string[] args) { GenerateHTML(); ProcessStartInfo startInfo =new ProcessStartInfo("IExplore.exe"); startInfo.Arguments = Environment.CurrentDirectory +"\\index.html"; Process process1 =new Process(); process1.StartInfo = startInfo; process1.Start(); }static void G 阅读全文
posted @ 2011-12-18 10:41 戴眼镜的乌龟 阅读(918) 评论(0) 推荐(0) 编辑
摘要:今天用到了CheckedListBox,就见到总结一下常用的知识。1、添加项:Items.AddcheckedListBox1.Items.Add("June");checkedListBox1.Items.Add("Jun");复制代码2、判断第i项是否选中GetItemChecked(index)checkedListBox1.GetItemChecked(i)3、设置第i项是否选中SetItemChecked(index,bool)或者SetItemCheckState(index,CheckState)checkedListBox1.SetIte 阅读全文
posted @ 2011-12-16 10:25 戴眼镜的乌龟 阅读(486) 评论(0) 推荐(0) 编辑
摘要:出现这个问题【线程间操作无效: 从不是创建控件“listview”的线程访问它】,用下面这个方法delegate void WriteMessage(string str); //写信息 //设置操作信息 private void SetListBoxMsg(string str) { if (this.lbMsg.InvokeRequired) { WriteMessage wm = new WriteMessage(SetListBoxMsg); ... 阅读全文
posted @ 2011-12-11 17:25 戴眼镜的乌龟 阅读(380) 评论(0) 推荐(0) 编辑
摘要:出现这个问题【线程间操作无效: 从不是创建控件“listview”的线程访问它】用下面这种方法 string Temp1 = "", Temp2 = ""; delegate void GetMessage(int rows); //定义一个委托 //获取ListView值 private void GetListViewValue(int rows) { ListViewItem lvi = new ListViewItem(); if (this.lvAccount.InvokeRe... 阅读全文
posted @ 2011-12-11 17:24 戴眼镜的乌龟 阅读(295) 评论(0) 推荐(0) 编辑
摘要:OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = Environment.CurrentDirectory; ofd.Filter = "txt files (*.txt)|*.txt"; if (ofd.ShowDialog() == DialogResult.OK) { string fileName = ofd.FileName; string strline = ""; using (StreamReader sr = new StreamReader(fileNa 阅读全文
posted @ 2011-12-08 10:29 戴眼镜的乌龟 阅读(371) 评论(0) 推荐(0) 编辑