摘要: ..\表示上一级目录.\表示当前目录\表示根目录在unix下则斜杠反过来写 阅读全文
posted @ 2013-11-29 13:30 live in finally 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 1.窗体最大化时非全屏不会遮盖任务栏private void btnFormMax_Click(object sender, EventArgs e){if (this.WindowState == FormWindowState.Maximized){this.WindowState = FormWindowState.Normal;}else{this.WindowState = FormWindowState.Maximized;}}此时this.FormBorderStyle.默认为Sizable2.窗体最大化时会全屏及遮盖任务栏private void btnFormMax_Clic 阅读全文
posted @ 2013-11-29 09:41 live in finally 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 委托就是以方法为参数的类型。不懂,看代码正常情况下是这样的有个方法是public void Love(string country){ messagebox.show("I Love"+" "+country);}你要调用这个方法是不是这样的啊string m="中国!";Love(m);委托就是在这个例子中,Love若是为委托的话,那么m就是一个方法。但是这样的效果肯定不好,I Love 中国 应该为 我爱中国加个判断 if(country="中国") messagebox.show("我爱" 阅读全文
posted @ 2013-11-28 23:39 live in finally 阅读(205) 评论(0) 推荐(0) 编辑
摘要: private void button1_Click(object sender, EventArgs e) { string path = this.textBox1.Text; byte[] imgBytesIn = SaveImage(path); ShowImgByByte(imgBytesIn); //Parameters.Add("@Photo", SqlDbType.Binary).Value = imgBytesIn; } //将图片以二进制流 public byte[] SaveImage(String path) { FileStream fs = ne 阅读全文
posted @ 2013-11-28 18:05 live in finally 阅读(343) 评论(0) 推荐(0) 编辑
摘要: .Net调用其他语言写的dll 不过要知道方法名和参数列表class Card { [DllImport("hdr__wc.DLL",SetLastError=true)] public static extern int init_com(int init); [DllImport("hdr__wc.DLL",SetLastError=true)] public static extern int sele_card( int m); }Card.init_com(0); 阅读全文
posted @ 2013-11-27 14:29 live in finally 阅读(344) 评论(0) 推荐(0) 编辑
摘要: ZoneAdd zone = new ZoneAdd(); //zone.Controls.Clear(); //TreeView tree = new TreeView(); //zone.Controls.Add(tree); //ContextMenuStrip menuStrip = new ContextMenuStrip(); //menuStrip.TopLevel = false; //menuStrip.Text = "商品类型的快捷设置"; //ToolStripItem add; // add = new System.Windows.Forms.To 阅读全文
posted @ 2013-11-25 15:06 live in finally 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Point p = new Point(100,100);Control lab = panel1.GetChildAtPoint(p);Label l = (Label)lab; 这样就可以找到指定位置的控件了,, panel1 是你索要查找的控件的父控件 p 就是控件的位置 阅读全文
posted @ 2013-11-21 16:13 live in finally 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 刚开始拖控件上去的时候,所加的列没有显示其实是要把它的 view 改为details就行了,,若是想加数据ListViewItem item = new ListViewItem(); item.Text = "第一行第一列"; item.SubItems.Add("第一行第二列"); listView1.Items.Add("第二行第一列"); listView1.Items.Add(item);item 给我的感觉就是行,,列自然还是column控件默认的选中的时候就是第一行第一列 ,显然不符合要求,要把它改为选中一行的效果,还是 阅读全文
posted @ 2013-11-19 22:30 live in finally 阅读(279) 评论(0) 推荐(1) 编辑
摘要: 一般来说,在更新DataTable或是DataSet时,如果不采用SqlParameter,那么当输入的Sql语句出现歧义时,如字符串中含有单引号,程序就会发生错误,并且他人可以轻易地通过拼接Sql语句来进行注入攻击。?123456789101112131415161718string sql = "update Table1 set name = 'Pudding' where ID = '1'";//未采用SqlParameter SqlConnection conn = new SqlConnection(); conn.Connect 阅读全文
posted @ 2013-11-19 13:14 live in finally 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 1 c# 的虚拟方法,关键字就是virtual,方法声明为虚拟方法才能被ovveride.2 隐藏方法的 比如我写个class,你继承我的class 就叫YouClass,但是以后我发现我写的MyClass ,功能跟不上潮流了,要改方法,看到你在继承的类的里,写了一个方法h(),我在MyClass里也是有了一个 h(),虽然两个方法的都是一样的签名,但是都没有使用virtual和ovverifde,但是只是方法的名字相同,其实方法体完全不同,但是我要调用的时候,那我应该调用那个方法呢,,貌似是有点冲突的,,我们这时候就可以使用方法的隐藏了public new int H(){ }这样就能实现方 阅读全文
posted @ 2013-11-12 22:44 live in finally 阅读(133) 评论(0) 推荐(0) 编辑