- 博客(10)
- 收藏
- 关注
转载 C# 文件夹,文件操作
1 设置文件保存路径FolderBrowserDialog fbd = new FolderBrowserDialog();fbd.ShowDialog();folderName = fbd.SelectedPath; //获得选择的文件夹路径2 向文件中写入数据 FileStream fs = new FileStream(savePath,FileMo...
2016-08-23 20:22:00
116
转载 Winform部分控件使用
1:ComboBox控件使用1.1:设置默认数值 cmbCheck.SelectedIndex = 0;1.2:添加集合string[] ports; cmbPortName.Items.AddRange(ports);1.3:获取选项数值comm.PortName = cmbPortName.Text;1.4:设置控件样式...
2016-08-23 20:18:00
160
转载 C# 串口通信使用简结
1:获取所有串口名称并排序string[] ports = SerialPort.GetPortNames();Array.Sort(ports);2:设置串口通信参数并打开串口// 创建串口实例 private SerialPort comm = new SerialPort();// 设置端口名称、波特率、校验位、停止位等参数 comm.Por...
2016-08-23 20:08:00
199
转载 C# Wiform GDI+ 模拟图层功能
在使用GDI+绘制图形时,为了实现如AutoCAD那样分层进行绘制各种类型的线,设计了一种模拟图层实现的方法。 实现思路:将要绘制的图形点存放在不同的链表中,根据图层的可见性,绘制不同的图形。 具体实现: 一、设计图层类 BitMapLayer类 字段设计private string _name; private bool _isVisi...
2016-04-28 14:05:00
1027
转载 c# 配置文件的读写
一、配置文件 app.config<?xml version="1.0" encoding="utf-8" ?><configuration> <appSettings> <add key="String1" value="value1" /> <add key="String...
2016-04-25 21:47:00
206
转载 GDI+的使用
一、创建画布方法1:Graphics g = this.CreateGraphics();方法2:Bitmap bitmap = new Bitmap(picBTrackReplay.Width, picBTrackReplay.Height);Graphics g = Graphics.FromImage(bitmap);picBTrackReplay...
2016-04-25 21:32:00
140
转载 C#排序--Linq方法
1 List<ObservePoints> pointsInRectangle = new List<ObservePoints>(); 2 3 IEnumerable<ObservePoints> query = null; 4 query = from items in pointsInRectangle orderb...
2016-04-13 14:32:00
170
转载 C# 对象序列化和反序列化
在优快云和博客园中搜到比较详细的序列化与反序列化说明,现将博文链接整理出来,方便学习、交流。参考博文:1、深入C#学习系列一:序列化(Serialize)、反序列化(Deserialize)http://www.cnblogs.com/qqflying/archive/2008/01/13/1037262.html2、C#对象序列化与反序列化http://www.c...
2016-04-07 09:50:00
94
转载 C# 添加鼠标滚轮事件
首先定义窗体鼠标滚轮事件 1 private void Form1_MouseWheel(object sender, MouseEventArgs e) 2 { 3 Graphics g=this.CreateGraphics(); // GDI+绘图 4 g.Clear(BackColor); ...
2016-04-06 11:58:00
581
转载 C# Winform检查所有textBox内容是否为空--采用控件数据方式
1 foreach(Control c in this.Controls) 2 { 3 if (c is TextBox) 4 { 5 if (string.IsNullOrEmpty((c as TextBox).Text)) 6 { 7 MessageBox.Show("请正确填写内容,带*为必填内容"); 8 ...
2016-04-01 10:25:00
825
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人