04 2013 档案

摘要:1.只是显示图片string path =相对路径 path =绝对路径BitmapImage image = new BitmapImage(new Uri(path, UriKind.Absolute));img.Source = image;2.在另一段代码中,要删除这个图片就需要先把图片转换成文件流,在当前读取流完时,关闭流,当要删除图片时释放资源,修改代码如下:System.IO.FileStream m_ImageStream;string path;string path =相对路径path =绝对路径BitmapImage image = new BitmapImage();m 阅读全文
posted @ 2013-04-28 17:26 金虹巴巴 阅读(434) 评论(0) 推荐(0) 编辑
摘要:public DataTable ToDataTable(DataRow[] rows) { if (rows == null || rows.Length == 0) return null; DataTable tmp = rows[0].Table.Clone(); // 复制DataRow的表结构 foreach (DataRow row in rows) tmp.Rows.Add(row); // 将DataRow添加到DataTable中 return tmp; }////////////... 阅读全文
posted @ 2013-04-26 16:36 金虹巴巴 阅读(1091) 评论(0) 推荐(0) 编辑
摘要:定义多个Listbox,可以实现相互拖动,如listbox1,listbox2,设置如下allowdrop=true和this.listBox2.DragDrop += new System.Windows.Forms.DragEventHandler(this.ListBox1_DragDrop); this.listBox2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ListBox1_MouseDown); this.listBox2.DragOver += new System.Windows.Forms.D 阅读全文
posted @ 2013-04-26 09:41 金虹巴巴 阅读(4443) 评论(0) 推荐(0) 编辑
摘要:///<summary>///上移///</summary>///<paramname="sender"></param>///<paramname="e"></param>privatevoidtsbMoveUp_Click(objectsender,EventArgse){if(Tv_tree.SelectedNode==null){MessageBox.Show("请选择需要移动的的节点!");this.Focus();return;}foldermodel 阅读全文
posted @ 2013-04-23 11:15 金虹巴巴 阅读(1078) 评论(0) 推荐(0) 编辑
摘要:现有装满Customer对象的List<Customer>一个,Customer里面有一属性orderID 是数字现在想根据Customer.orderID将List<Customer>排序 请问要怎么做?如果你用的是3.5的framework,用lamda表达式就可以实现,很简单。假设这里开始构建list:List<Customer> list=new List<Customer>();list.add();.......--------这里进行排序-----------list.Sort((customer1, customer2) => 阅读全文
posted @ 2013-04-18 13:15 金虹巴巴 阅读(228) 评论(0) 推荐(0) 编辑
摘要:c# 读写文件时文件正由另一进程使用,因此该进程无法访问该文件,在IO处理上遇到了无法操作的问题。文件“D:\log.txt”正由另一进程使用,因此该进程无法访问该文件。log.txt是一个日志文件,不定时都可能由另外的程序对它进行日志记录写入操作。今需要对日志文件读取出来,显示在日志查询里,需要用到了IO流。 1、 FileStream fs = File.OpenRead(url);StreamReader sr = new StreamReader((System.IO.Stream)fs, System.Text.Encoding.Default);错误提示:文件“D:\Log\Car 阅读全文
posted @ 2013-04-09 14:32 金虹巴巴 阅读(9630) 评论(0) 推荐(0) 编辑
摘要:bool isChinses = System.Text.RegularExpressions.Regex.IsMatch(strSearchKey, @"[\u4e00-\u9fa5]+$");/////////////////////string s = "hello你好"; for(int i = 0;i<s.Length,i++) { if((s[i]>'a' && s[i]<'z') || (s[i]>'A' && s[i]<' 阅读全文
posted @ 2013-04-01 10:01 金虹巴巴 阅读(199) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示