随笔分类 -  C# Winform

C# Winform的Panle中添加窗体
摘要:WindowsFormsApplication34.Class1.form2.TopLevel = false;WindowsFormsApplication34.Class1.form2.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;WindowsFormsApplication34.Class1.form2.Dock = DockStyle.Fill;this.splitContainer1.Panel2.Controls.Add(WindowsFormsApplication34.Class1.form2);Win 阅读全文
posted @ 2012-10-19 17:34 没有你我无法微笑 阅读(243) 评论(0) 推荐(0)
C# winform对MsChart的简单功能
摘要:一、程序控制创建Chartareafor(int i=0;i<2;i++){ChartArea newchartarea = new ChartArea();newchartarea.Name = i.ToString();chart1.ChartAreas.Add(newchartarea);}二、图表对应chart1.Series[(i - 1).ToString()].ChartArea = (i - 1).ToString();chart1.Series[(i - 2).ToString()].ChartArea = (i - 2).ToString();三、设置series的类 阅读全文
posted @ 2012-10-11 14:41 没有你我无法微笑 阅读(798) 评论(0) 推荐(0)
C# 操作文件
摘要:C#追加文件 StreamWriter sw = File.AppendText(Server.MapPath(".")+"//myText.txt"); sw.WriteLine("追逐理想"); sw.WriteLine("kzlll"); sw.WriteLine(".NET笔记"); sw.Flush(); sw.Close();C#拷贝文件 string OrignFile,NewFile; OrignFile = Server.MapPath(".")+" 阅读全文
posted @ 2012-09-10 16:28 没有你我无法微笑 阅读(279) 评论(0) 推荐(0)
C# Winform读取ini文件
摘要:1,首先导入命名空间:using System.Runtime.InteropServices;2,声明API函数 [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);3,创建ini文件path = Application.StartupPath + "\\ClientCfg.ini";private void WriteIni(){ Wri 阅读全文
posted @ 2012-09-10 15:34 没有你我无法微笑 阅读(1075) 评论(0) 推荐(0)
ADO.NET 连接数据库
摘要:1:添加命名空间 System.Data.SqlClient中的SQL Server访问类;2:与SQL Server数据库建立连接,ADO.NET提供Connection对象用于建立与SQL Server数据库的连接 string connectionStr = "server=.;database=Train;uid=sa;pwd=123456"; //定义连接字符串 SqlConnection connection = new SqlConnection (connectionStr); //实例化Connection对象用于连接数据源 connection.Open 阅读全文
posted @ 2012-09-10 15:28 没有你我无法微笑 阅读(305) 评论(0) 推荐(0)