- 浏览: 112273 次
- 性别:
- 来自: 昆明
-
文章分类
- 全部博客 (151)
- 120D02 (5)
- 直升机 (1)
- 我的技术资料收集 (82)
- 的技术资料收集 (4)
- .NET Solution (2)
- ASP.NET (1)
- Linq to sql (1)
- 数据库技术(MS SQL) (2)
- 架构/设计 (1)
- 敏捷/持续集成 (1)
- C#.NET开发 (1)
- Matlab开发 (1)
- WinForm开发 (1)
- 开源技术 (1)
- jQuery (1)
- 我的博文 (4)
- js (2)
- android (2)
- 9. 读书笔记 (1)
- CSS3 (1)
- HTML5 (1)
- JavaScript (5)
- 移动开发 (2)
- 编程心得 (1)
- Linux操作系统 (1)
- (BI)商业智能 (1)
- IOS (1)
- Windows Phone (2)
- C# API (1)
- JQuery系列 (1)
- TFS (1)
- C# (2)
- ExtJs (1)
- .NET (1)
- Nginx (1)
- WCF学习笔记 (1)
- Computer Graphic (1)
- IT产品 (1)
- 工具分享 (1)
- MySelf (1)
- C#专栏 (1)
- 管理 (1)
- 基于Oracle Logminer数据同步 (1)
- 日常 (1)
- 实用工具 (1)
- 网页设计 (1)
- avalon (1)
- flash (1)
- DDD (1)
- 01 技术Android (1)
- WCF (1)
- selenium (1)
最新评论
-
464410531:
三国杀。。。。。。。。。。。。。。。。。。。。。。。。。。。。 ...
实用的职场宝典:不提拔你,就因为你只想把工作做好
原帖地址:http://www.cnblogs.com/liyifeng/p/WF.html

1.button(曹操,贡天子以令不臣):
属性;text:我们经常可以看见将按钮命名为“登入”,在其属性面板里面编辑text即可;如下图:
事件:click是我们常常用到的,点击按钮发生的事件,如,弹出:你好!,在事件面板下click下就可完成,:
其中代码如下:
1 private void button1_Click(object sender, EventArgs e)
2 {
3 MessageBox.Show("欢迎你!");
4 }
2 {
3 MessageBox.Show("欢迎你!");
4 }
2.textBox:
其中我们在输入密码的时候会用到一个属性:passworchar,来掩饰密码:
1 private void groupBox1_Enter(object sender, EventArgs e)
2 {
3 textBox2.PasswordChar='*';
4 }
2 {
3 textBox2.PasswordChar='*';
4 }
2.1,RichTextBox,
3.经过以上的描述我就写个连贯的控件来叙述;
3.1.一个登入面板,要求账号为:lixiaofeng,密码;6080;
3.1.1.进入面板点击登入按钮的代码(其中的验证涉及到验证控件errorprovider):
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10
11 namespace WindowsFormsApplication1
12 {
13 public partial class Form1 : Form
14 {
15 public Form1()
16 {
17 InitializeComponent();
18 }
19
20 private void Form1_Load(object sender, EventArgs e)
21 {
22
23 }
24
25 private void button1_Click(object sender, EventArgs e)
26 {
27
28 }
29
30 private void groupBox1_Enter(object sender, EventArgs e)
31 {
32
33 }
34
35 private void button1_Click_1(object sender, EventArgs e)
36 {
37
38 //首先要求账号输入长度大于3,其次密码为int型,所以就要写个验证代码提示,如下:
39 if (textBox1.Text == "") //判断是否为空
40 { errorProvider1.SetError(textBox1, "对不起,这里不能为空!"); }
41 else
42 {
43 try
44 {
45 if (textBox1.Text.Length > 3)
46 { errorProvider1.SetError(textBox1, ""); }
47 else
48 { errorProvider1.SetError(textBox1, "要求要输入3个以上的数据!"); }
49 }
50 catch
51 { errorProvider1.SetError(textBox1,"您的输入有问题,请重新输入!"); }
52 }
53 if (textBox2.Text == "")
54 { errorProvider1.SetError(textBox2, "对不起,这里不能为空!"); }
55 else
56 {
57 try
58 { int i = Int32.Parse(textBox2.Text.Trim()); errorProvider1.SetError(textBox2, ""); } //判断是否输入的是int数字
59 catch
60 { errorProvider1.SetError(textBox2,"这里只能输入数字密码!"); }
61 }
62
63 //满足账号为:lixiaofeng 密码是:6080 即可进入,代码如下:
64 if (textBox1.Text == "lixiaofeng" && Int32.Parse(textBox2.Text.Trim()) == 6080)
65 { Form2 f2 = new Form2(); f2.Show(); } //打开登入后的页面
66
67 this.AcceptButton = button1;//默认按下回车后==点击登入按钮
68
69 }
70
71 private void textBox2_TextChanged(object sender, EventArgs e)
72 {
73 label3.Text = textBox2.Text.Trim(); //密码翻译
74 }
75 }
76 }
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10
11 namespace WindowsFormsApplication1
12 {
13 public partial class Form1 : Form
14 {
15 public Form1()
16 {
17 InitializeComponent();
18 }
19
20 private void Form1_Load(object sender, EventArgs e)
21 {
22
23 }
24
25 private void button1_Click(object sender, EventArgs e)
26 {
27
28 }
29
30 private void groupBox1_Enter(object sender, EventArgs e)
31 {
32
33 }
34
35 private void button1_Click_1(object sender, EventArgs e)
36 {
37
38 //首先要求账号输入长度大于3,其次密码为int型,所以就要写个验证代码提示,如下:
39 if (textBox1.Text == "") //判断是否为空
40 { errorProvider1.SetError(textBox1, "对不起,这里不能为空!"); }
41 else
42 {
43 try
44 {
45 if (textBox1.Text.Length > 3)
46 { errorProvider1.SetError(textBox1, ""); }
47 else
48 { errorProvider1.SetError(textBox1, "要求要输入3个以上的数据!"); }
49 }
50 catch
51 { errorProvider1.SetError(textBox1,"您的输入有问题,请重新输入!"); }
52 }
53 if (textBox2.Text == "")
54 { errorProvider1.SetError(textBox2, "对不起,这里不能为空!"); }
55 else
56 {
57 try
58 { int i = Int32.Parse(textBox2.Text.Trim()); errorProvider1.SetError(textBox2, ""); } //判断是否输入的是int数字
59 catch
60 { errorProvider1.SetError(textBox2,"这里只能输入数字密码!"); }
61 }
62
63 //满足账号为:lixiaofeng 密码是:6080 即可进入,代码如下:
64 if (textBox1.Text == "lixiaofeng" && Int32.Parse(textBox2.Text.Trim()) == 6080)
65 { Form2 f2 = new Form2(); f2.Show(); } //打开登入后的页面
66
67 this.AcceptButton = button1;//默认按下回车后==点击登入按钮
68
69 }
70
71 private void textBox2_TextChanged(object sender, EventArgs e)
72 {
73 label3.Text = textBox2.Text.Trim(); //密码翻译
74 }
75 }
76 }
4.计算器/添加器;
计算器:
需要的控件有:imagelist/tabcontrol,
在命名,加载图片完成后,要求选择运算功能后记录运算记录:
4.1.选项卡加载图片:
1 private void Form2_Load(object sender, EventArgs e)
2 {
3 //首先添加当前的选项卡图标;
4 tabControl1.ImageList = imageList1;
5 tabPage1.ImageIndex = 0; tabPage2.ImageIndex = 1;
2 {
3 //首先添加当前的选项卡图标;
4 tabControl1.ImageList = imageList1;
5 tabPage1.ImageIndex = 0; tabPage2.ImageIndex = 1;
4.2.点击运算后的过程代码:
1 private void button5_Click(object sender, EventArgs e)
2 {
3 double deshu=0;
4 if (textBox2.Text == "")
5 { MessageBox.Show("请输入数据!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
6 else
7 {
8
9 if (radioButton1.Checked == true) //选择加法功能
10 {
11 string[] fengejieshou = textBox2.Text.Split('+'); //分割“+”存储
12 for (int i = 0; i < fengejieshou.Length; i++)
13 { deshu += Convert.ToDouble(fengejieshou[i]); } //做加法运算
14 textBox3.Text = deshu.ToString(); //输出结果显示
15 }
16 else //没有选择运算功能就进行提示
17 { MessageBox.Show("请选择运算功能","",MessageBoxButtons.OK,MessageBoxIcon.Asterisk ); }
18
19 }
20
21 //将运算记录写入登记表中去:
22 //设置其滚动条等属性;
23 listBox1.HorizontalScrollbar = true; listBox1.HorizontalScrollbar = true;
24 //设置其编辑属性:
25 listBox1.SelectionMode = SelectionMode.MultiExtended;
26 //写入记录:
27 string xierujilu = string.Format("操作数:{0}\t计算结果是:{1}",textBox2.Text,deshu.ToString()); //整理数据字符串
28 listBox1.Items.Add(xierujilu ); //写入到表中
29
30 }
2 {
3 double deshu=0;
4 if (textBox2.Text == "")
5 { MessageBox.Show("请输入数据!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
6 else
7 {
8
9 if (radioButton1.Checked == true) //选择加法功能
10 {
11 string[] fengejieshou = textBox2.Text.Split('+'); //分割“+”存储
12 for (int i = 0; i < fengejieshou.Length; i++)
13 { deshu += Convert.ToDouble(fengejieshou[i]); } //做加法运算
14 textBox3.Text = deshu.ToString(); //输出结果显示
15 }
16 else //没有选择运算功能就进行提示
17 { MessageBox.Show("请选择运算功能","",MessageBoxButtons.OK,MessageBoxIcon.Asterisk ); }
18
19 }
20
21 //将运算记录写入登记表中去:
22 //设置其滚动条等属性;
23 listBox1.HorizontalScrollbar = true; listBox1.HorizontalScrollbar = true;
24 //设置其编辑属性:
25 listBox1.SelectionMode = SelectionMode.MultiExtended;
26 //写入记录:
27 string xierujilu = string.Format("操作数:{0}\t计算结果是:{1}",textBox2.Text,deshu.ToString()); //整理数据字符串
28 listBox1.Items.Add(xierujilu ); //写入到表中
29
30 }
4.3.添加选项卡/及文本链接功能:
对选项卡的添加/删除/清空代码:
4.4.添加:
1 private void button1_Click(object sender, EventArgs e)
2 {
3 //手动添加选项卡代码的实现:
4 if (textBox1.Text == "")
5 { MessageBox.Show("请输入新选项卡的名字!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
6 else
7 { tabControl1.TabPages.Add(textBox1.Text ); //添加新选项卡
8 tabControl1.TabPages[tabControl1.TabCount-1].ImageIndex=2; //向新卡添加图片
9 textBox1.Text = "";//清空输入信息
10 }
2 {
3 //手动添加选项卡代码的实现:
4 if (textBox1.Text == "")
5 { MessageBox.Show("请输入新选项卡的名字!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
6 else
7 { tabControl1.TabPages.Add(textBox1.Text ); //添加新选项卡
8 tabControl1.TabPages[tabControl1.TabCount-1].ImageIndex=2; //向新卡添加图片
9 textBox1.Text = "";//清空输入信息
10 }
4.5.删除:
1 private void button2_Click(object sender, EventArgs e)
2 {
3 //删除选项卡代码:
4 if (tabControl1.SelectedIndex == 0 || tabControl1.SelectedIndex == 1)
5 { MessageBox.Show("这里系统自带的无法删除!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
6 else
7 { tabControl1.TabPages.Remove(tabControl1.SelectedTab); } //删除
8 }
2 {
3 //删除选项卡代码:
4 if (tabControl1.SelectedIndex == 0 || tabControl1.SelectedIndex == 1)
5 { MessageBox.Show("这里系统自带的无法删除!", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
6 else
7 { tabControl1.TabPages.Remove(tabControl1.SelectedTab); } //删除
8 }
4.6.清空:
1 private void button3_Click(object sender, EventArgs e)
2 {
3 listView1.Items.Clear();
4 }
2 {
3 listView1.Items.Clear();
4 }
4.7.超文本链接:
1 private void tabPage2_Enter(object sender, EventArgs e)
2 {
3 //显示滚动条
4 richTextBox1.ScrollBars = RichTextBoxScrollBars.ForcedBoth;
5 //设置字体:
6 richTextBox1.SelectionFont = new Font("隶书", 12, FontStyle.Bold);
7 //字体颜色;
8 richTextBox1.SelectionColor = System.Drawing.Color.Red;
9 //字体text属性
10 richTextBox1.Text = "欢迎进入我的博客园:http://www.cnblogs.com/liyifeng/";
11 }
2 {
3 //显示滚动条
4 richTextBox1.ScrollBars = RichTextBoxScrollBars.ForcedBoth;
5 //设置字体:
6 richTextBox1.SelectionFont = new Font("隶书", 12, FontStyle.Bold);
7 //字体颜色;
8 richTextBox1.SelectionColor = System.Drawing.Color.Red;
9 //字体text属性
10 richTextBox1.Text = "欢迎进入我的博客园:http://www.cnblogs.com/liyifeng/";
11 }
1 private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)
2 {
3 System.Diagnostics.Process.Start(e.LinkText ); //链接文本
4 }
2 {
3 System.Diagnostics.Process.Start(e.LinkText ); //链接文本
4 }
5.资源管理器:
5.1.添加节点,并添加节点图片:
1 public void Form3_Load(object sender, EventArgs e)
2 {
3 //工具和视图,为2个根节点:
4 TreeNode t1 = treeView1.Nodes.Add("工具");
5 TreeNode t2 = treeView1.Nodes.Add("视图");
6 //在工具节点中添加2个子节点,和编辑相应的对象:
7 TreeNode t11 = new TreeNode("运算器/选项卡"); TreeNode t12 = new TreeNode("添加视图");
8 t1.Tag = "1"; t11.Tag = "11"; t12.Tag = "12";
9 t1.Nodes.Add(t11); t1.Nodes.Add(t12);
10 //在视图中添加3个子节点:
11 TreeNode t21 = new TreeNode("平铺"); TreeNode t22 = new TreeNode("垂直"); TreeNode t23 = new TreeNode("层叠");
12 t2.Tag = "2"; t21.Tag = "21"; t22.Tag = "22"; t23.Tag = "23";
13 t2.Nodes.Add(t21); t2.Nodes.Add(t22); t2.Nodes.Add(t23);
14
15 //添加节点的图片:
16 treeView1.ImageList = imageList1;
17 //设置2个根节点的图片:
18 t1.ImageIndex = 1; t1.SelectedImageIndex = 1; t2.ImageIndex = 2; t2.SelectedImageIndex = 2;
19
20
21 }
2 {
3 //工具和视图,为2个根节点:
4 TreeNode t1 = treeView1.Nodes.Add("工具");
5 TreeNode t2 = treeView1.Nodes.Add("视图");
6 //在工具节点中添加2个子节点,和编辑相应的对象:
7 TreeNode t11 = new TreeNode("运算器/选项卡"); TreeNode t12 = new TreeNode("添加视图");
8 t1.Tag = "1"; t11.Tag = "11"; t12.Tag = "12";
9 t1.Nodes.Add(t11); t1.Nodes.Add(t12);
10 //在视图中添加3个子节点:
11 TreeNode t21 = new TreeNode("平铺"); TreeNode t22 = new TreeNode("垂直"); TreeNode t23 = new TreeNode("层叠");
12 t2.Tag = "2"; t21.Tag = "21"; t22.Tag = "22"; t23.Tag = "23";
13 t2.Nodes.Add(t21); t2.Nodes.Add(t22); t2.Nodes.Add(t23);
14
15 //添加节点的图片:
16 treeView1.ImageList = imageList1;
17 //设置2个根节点的图片:
18 t1.ImageIndex = 1; t1.SelectedImageIndex = 1; t2.ImageIndex = 2; t2.SelectedImageIndex = 2;
19
20
21 }
5.2.编写双击节点后的事件:
1 private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
2 {
3 if (treeView1.SelectedNode.Tag == "11")
4 { Form2 f2 = new Form2(); f2.Show(); }//打开运算器页面
5 if (treeView1.SelectedNode.Tag == "12")
6 { Form4 f4 = new Form4(); f4.Show(); }
7 if (treeView1.SelectedNode.Tag == "21")
8 {
9 Form2 f2 = new Form2(); f2.MdiParent = this; Form4 f4 = new Form4(); f4.MdiParent = this;
10 f2.Show(); f4.Show();
11 LayoutMdi(MdiLayout.TileHorizontal );
12 }
13 if (treeView1.SelectedNode.Tag == "22")
14 {
15 Form2 f2 = new Form2(); f2.MdiParent = this; Form4 f4 = new Form4(); f4.MdiParent = this;
16 f2.Show(); f4.Show();
17 LayoutMdi(MdiLayout.TileVertical );
18 }
19 if (treeView1.SelectedNode.Tag == "23")
20 {
21 Form2 f2 = new Form2(); f2.MdiParent = this; Form4 f4 = new Form4(); f4.MdiParent = this;
22 f2.Show(); f4.Show();
23 LayoutMdi(MdiLayout.Cascade );
24 }
25
26
27 }
2 {
3 if (treeView1.SelectedNode.Tag == "11")
4 { Form2 f2 = new Form2(); f2.Show(); }//打开运算器页面
5 if (treeView1.SelectedNode.Tag == "12")
6 { Form4 f4 = new Form4(); f4.Show(); }
7 if (treeView1.SelectedNode.Tag == "21")
8 {
9 Form2 f2 = new Form2(); f2.MdiParent = this; Form4 f4 = new Form4(); f4.MdiParent = this;
10 f2.Show(); f4.Show();
11 LayoutMdi(MdiLayout.TileHorizontal );
12 }
13 if (treeView1.SelectedNode.Tag == "22")
14 {
15 Form2 f2 = new Form2(); f2.MdiParent = this; Form4 f4 = new Form4(); f4.MdiParent = this;
16 f2.Show(); f4.Show();
17 LayoutMdi(MdiLayout.TileVertical );
18 }
19 if (treeView1.SelectedNode.Tag == "23")
20 {
21 Form2 f2 = new Form2(); f2.MdiParent = this; Form4 f4 = new Form4(); f4.MdiParent = this;
22 f2.Show(); f4.Show();
23 LayoutMdi(MdiLayout.Cascade );
24 }
25
26
27 }
5.3:运行图示:
6.菜单添加器:
6.1分组及集合的编写:
1 private void Form4_Load(object sender, EventArgs e)
2 {
3 //创建2个分组:
4 listView1.Groups.Add(new ListViewGroup("相片",HorizontalAlignment.Left ));
5 listView1.Groups.Add(new ListViewGroup("其他",HorizontalAlignment.Left ));
6 //创建2个图标集合:
7 listView1.Items.Add("我的书法"); listView1.Items.Add("相片");
8 //将其添加都分组为:相片组里:
9 listView1.Items[0].Group=listView1.Groups[0];listView1.Items[1].Group=listView1.Groups[0];
10
11 //将杂集放到,其他里面
12 listView1.Items.Add("杂集");
13 listView1.Items[2].Group=listView1.Groups[1];
14
15 //设置视图样式:
16 listView1.View = View.Tile;
17 //向视图中添加图片:
18 listView1.LargeImageList = imageList1;
19 listView1.Items[0].ImageIndex = 0; listView1.Items[1].ImageIndex = 1; listView1.Items[2].ImageIndex = 2;
20
21
22 }
2 {
3 //创建2个分组:
4 listView1.Groups.Add(new ListViewGroup("相片",HorizontalAlignment.Left ));
5 listView1.Groups.Add(new ListViewGroup("其他",HorizontalAlignment.Left ));
6 //创建2个图标集合:
7 listView1.Items.Add("我的书法"); listView1.Items.Add("相片");
8 //将其添加都分组为:相片组里:
9 listView1.Items[0].Group=listView1.Groups[0];listView1.Items[1].Group=listView1.Groups[0];
10
11 //将杂集放到,其他里面
12 listView1.Items.Add("杂集");
13 listView1.Items[2].Group=listView1.Groups[1];
14
15 //设置视图样式:
16 listView1.View = View.Tile;
17 //向视图中添加图片:
18 listView1.LargeImageList = imageList1;
19 listView1.Items[0].ImageIndex = 0; listView1.Items[1].ImageIndex = 1; listView1.Items[2].ImageIndex = 2;
20
21
22 }
6.2添加/删除/清空,的功能:
1 private void button1_Click(object sender, EventArgs e)
2 {
3 //以下为添加信息的同时添加视图的图片:
4 if (textBox1.Text == "")
5 { MessageBox.Show("请输入要添加的命名"); }
6 else
7 { listView1.Items.Add(textBox1.Text.Trim());
8 listView1.Items[listView1.Items.Count-1].Group=listView1.Groups[1];
9 listView1.Items[listView1.Items.Count - 1].ImageIndex = 3;
10 textBox1.Text = "";
11 }
12 }
13
14 private void button2_Click(object sender, EventArgs e)
15 {
16 listView1.Items.RemoveAt(listView1.SelectedItems[0].Index );
17 }
18
19 private void button3_Click(object sender, EventArgs e)
20 {
21 listView1.Items.Clear();
22 }
2 {
3 //以下为添加信息的同时添加视图的图片:
4 if (textBox1.Text == "")
5 { MessageBox.Show("请输入要添加的命名"); }
6 else
7 { listView1.Items.Add(textBox1.Text.Trim());
8 listView1.Items[listView1.Items.Count-1].Group=listView1.Groups[1];
9 listView1.Items[listView1.Items.Count - 1].ImageIndex = 3;
10 textBox1.Text = "";
11 }
12 }
13
14 private void button2_Click(object sender, EventArgs e)
15 {
16 listView1.Items.RemoveAt(listView1.SelectedItems[0].Index );
17 }
18
19 private void button3_Click(object sender, EventArgs e)
20 {
21 listView1.Items.Clear();
22 }
6.3,进入:管控页面的代码:
1 private void button4_Click(object sender, EventArgs e)
2 {
3 Form5 f5 = new Form5(); f5.Show();
4 }
2 {
3 Form5 f5 = new Form5(); f5.Show();
4 }
7.管控全局页面:
其代码如下:
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10
11 namespace WindowsFormsApplication1
12 {
13 public partial class Form5 : Form
14 {
15 public Form5()
16 {
17 InitializeComponent();
18 }
19
20 private void tabPage1_Click(object sender, EventArgs e)
21 {
22
23 }
24
25 private void tabPage2_Click(object sender, EventArgs e)
26 {
27 //设置闹钟的属性:
28 timer1.Interval = 1000;
29 }
30
31 private void button1_Click(object sender, EventArgs e)
32 {
33 if (button1.Text == "开始")
34 { timer1.Enabled = true; button1.Text = "停止"; }
35 else
36 { timer1.Enabled = false; button1.Text = "开始"; textBox1.Text = "时间到了!"; }
37 }
38
39 private void timer1_Tick(object sender, EventArgs e)
40 {
41 textBox1.Text = DateTime.Now.ToString();
42 }
43
44 private void groupBox2_Enter(object sender, EventArgs e)
45 {
46 progressBar1.Minimum = 0; progressBar1.Maximum = 899; progressBar1.Step = 1;
47
48 }
49
50 private void button2_Click(object sender, EventArgs e)
51 {
52 for (int i = 0; i < 900; i++)
53 { progressBar1.PerformStep();
54 textBox2.Text = "进度是:" + progressBar1.Value.ToString();
55 }
56 }
57
58 private void groupBox3_Enter(object sender, EventArgs e)
59 {
60 //显示的时间为自定义的时间格式:
61 dateTimePicker1.Format = DateTimePickerFormat.Custom;
62 dateTimePicker1.CustomFormat = "yy-MM-dd HH:mm";
63
64 //设置月历的颜色属性:
65 monthCalendar1.TitleBackColor = System.Drawing.Color.Red;
66 monthCalendar1.TrailingForeColor = System.Drawing.Color.Black;
67 monthCalendar1.TitleForeColor = System.Drawing.Color.Green;
68 //显示周期:
69 monthCalendar1.ShowWeekNumbers = true;
70 //突出特定的日期;
71 DateTime shijian_shuru = new DateTime(2013, 6, 28);
72 monthCalendar1.AddAnnuallyBoldedDate(shijian_shuru);
73 //显示2列月历:
74 monthCalendar1.CalendarDimensions =new Size(2,1);
75 }
76
77 private void 看时间ToolStripMenuItem_Click(object sender, EventArgs e)
78 {
79 Form1 f1 = new Form1();f1.Show();
80 }
81
82 private void 运算器ToolStripMenuItem_Click(object sender, EventArgs e)
83 {
84 Form2 f2 = new Form2(); f2.Show();
85 }
86
87 private void 资源管理器ToolStripMenuItem_Click(object sender, EventArgs e)
88 {
89 Form3 f3 = new Form3(); f3.Show();
90 }
91
92 private void 添加视图ToolStripMenuItem_Click(object sender, EventArgs e)
93 {
94 Form4 f4 = new Form4(); f4.Show();
95 }
96
97 private void toolStripStatusLabel1_Click(object sender, EventArgs e)
98 {
99
100 }
101
102 private void toolStripStatusLabel1_LocationChanged(object sender, EventArgs e)
103 {
104 toolStripStatusLabel1.Text = DateTime.Now.ToString();//显示时间
105 }
106
107 }
108 }
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10
11 namespace WindowsFormsApplication1
12 {
13 public partial class Form5 : Form
14 {
15 public Form5()
16 {
17 InitializeComponent();
18 }
19
20 private void tabPage1_Click(object sender, EventArgs e)
21 {
22
23 }
24
25 private void tabPage2_Click(object sender, EventArgs e)
26 {
27 //设置闹钟的属性:
28 timer1.Interval = 1000;
29 }
30
31 private void button1_Click(object sender, EventArgs e)
32 {
33 if (button1.Text == "开始")
34 { timer1.Enabled = true; button1.Text = "停止"; }
35 else
36 { timer1.Enabled = false; button1.Text = "开始"; textBox1.Text = "时间到了!"; }
37 }
38
39 private void timer1_Tick(object sender, EventArgs e)
40 {
41 textBox1.Text = DateTime.Now.ToString();
42 }
43
44 private void groupBox2_Enter(object sender, EventArgs e)
45 {
46 progressBar1.Minimum = 0; progressBar1.Maximum = 899; progressBar1.Step = 1;
47
48 }
49
50 private void button2_Click(object sender, EventArgs e)
51 {
52 for (int i = 0; i < 900; i++)
53 { progressBar1.PerformStep();
54 textBox2.Text = "进度是:" + progressBar1.Value.ToString();
55 }
56 }
57
58 private void groupBox3_Enter(object sender, EventArgs e)
59 {
60 //显示的时间为自定义的时间格式:
61 dateTimePicker1.Format = DateTimePickerFormat.Custom;
62 dateTimePicker1.CustomFormat = "yy-MM-dd HH:mm";
63
64 //设置月历的颜色属性:
65 monthCalendar1.TitleBackColor = System.Drawing.Color.Red;
66 monthCalendar1.TrailingForeColor = System.Drawing.Color.Black;
67 monthCalendar1.TitleForeColor = System.Drawing.Color.Green;
68 //显示周期:
69 monthCalendar1.ShowWeekNumbers = true;
70 //突出特定的日期;
71 DateTime shijian_shuru = new DateTime(2013, 6, 28);
72 monthCalendar1.AddAnnuallyBoldedDate(shijian_shuru);
73 //显示2列月历:
74 monthCalendar1.CalendarDimensions =new Size(2,1);
75 }
76
77 private void 看时间ToolStripMenuItem_Click(object sender, EventArgs e)
78 {
79 Form1 f1 = new Form1();f1.Show();
80 }
81
82 private void 运算器ToolStripMenuItem_Click(object sender, EventArgs e)
83 {
84 Form2 f2 = new Form2(); f2.Show();
85 }
86
87 private void 资源管理器ToolStripMenuItem_Click(object sender, EventArgs e)
88 {
89 Form3 f3 = new Form3(); f3.Show();
90 }
91
92 private void 添加视图ToolStripMenuItem_Click(object sender, EventArgs e)
93 {
94 Form4 f4 = new Form4(); f4.Show();
95 }
96
97 private void toolStripStatusLabel1_Click(object sender, EventArgs e)
98 {
99
100 }
101
102 private void toolStripStatusLabel1_LocationChanged(object sender, EventArgs e)
103 {
104 toolStripStatusLabel1.Text = DateTime.Now.ToString();//显示时间
105 }
106
107 }
108 }
运行:
O(∩_∩)O谢谢!
2013.6.28
李晓峰
本文链接:http://www.cnblogs.com/liyifeng/p/WF.html,转载请注明。
发表评论
-
Javascript:猜猜弹出的是啥?为啥? - 幸福框架
2013-06-28 13:33 454原帖地址:http://www.cnblogs.com/hap ... -
海量数据处理利器之Hash——在线邮件地址过滤 - MyDetail
2013-06-27 12:00 679原帖地址:http://www.cnblo ... -
ASP.NET MVC 4 for Visual Studio 2010 下载地址 - 张鸿伟
2013-06-27 11:48 775原帖地址:http://www.cnblogs.com/wei ... -
【ASP.NET Web API教程】6.2 ASP.NET Web API中的JSON和XML序列化 - r01cn
2013-06-26 11:00 931原帖地址:http://www.cnblogs.com/r01 ... -
[珠玑之椟]估算的应用与Little定律 - 五岳
2013-06-26 10:54 664原帖地址:http://www.cnblogs.com/wuy ... -
30行,金额转人民币大写的代码 - 史蒂芬.王
2013-06-26 10:42 1046原帖地址:http://www.cnblogs.com/ste ... -
从银行的钱荒看一个公司的团队建设 产品线过多最终导致最赚钱的项目面临破产 - James Li
2013-06-26 10:36 657原帖地址:http://www.cnblogs.com/Jam ... -
Windows 8 动手实验系列教程 实验6:设置和首选项 - zigzagPath
2013-06-25 13:39 563原帖地址:http://www.cnblogs.com/zig ... -
闲聊可穿戴设备 - shawn.xie
2013-06-25 13:33 633原帖地址:http://www.cnblo ... -
如何使用开源库,吐在VS2013发布之前,顺便介绍下VS2013的新特性"Bootstrap" - 量子计算机
2013-06-25 13:27 890原帖地址:http://www.cnblogs.com/DSh ... -
一步一步将自己的代码转换为观察者模式 - 文酱
2013-06-23 11:36 639原帖地址:http://www.cnblo ... -
iOS内存错误EXC_BAD_ACCESS的解决方法(message sent to deallocated instance) - VicStudio
2013-06-23 11:30 570原帖地址:http://www.cnblogs.com/vic ... -
记录asp.net在IE10下事件丢失排错经过 - Adming
2013-06-23 11:24 738原帖地址:http://www.cnblogs.com/wea ... -
记 FineUI 官方论坛所遭受的一次真实网络攻击!做一个像 ice 有道德的黑客! - 三生石上
2013-06-23 11:18 821原帖地址:http://www.cnblogs.com/san ... -
3、使用Oracle Logminer同步Demo
2013-06-19 10:33 588原帖地址:http://www.cnblogs.com/shi ... -
算法实践——数独的基本解法
2013-06-19 10:27 1475原帖地址:http://www.cnblogs.com/gre ... -
简单实现TCP下的大文件高效传输
2013-06-19 10:21 712原帖地址:http://www.cnblogs.com/sma ... -
avalon - 初步接触
2013-06-18 10:06 803原帖地址:http://www.cnblogs.com/aar ... -
Nginx学习笔记(一) Nginx架构
2013-06-18 09:59 550原帖地址:http://www.cnblogs.com/cod ... -
证书打印《二》
2013-06-17 10:47 561原帖地址:http://www.cnblogs.com/bin ...
相关推荐
内容概要:本文详细介绍了西门子S7-200SMART PLC与V20变频器通过Modbus RTU协议进行通信的具体方法和技术要点。首先阐述了硬件连接方式,强调了正确的接线和参数设置对于稳定通信的重要性。接着深入讲解了PLC程序的设计,包括Modbus主站初始化、启停控制、频率设定以及断电自恢复等功能模块的实现。此外还分享了一些实用的经验技巧,如避免通讯冲突、处理浮点数转换等问题。最后提到该方案已在实际生产环境中成功应用,表现出良好的稳定性和可靠性。 适合人群:从事自动化控制系统集成的技术人员,特别是熟悉西门子PLC和变频器产品的工程师。 使用场景及目标:适用于需要将旧型号PLC与变频器进行高效集成的企业,在不影响原有设备的基础上提升系统的智能化水平,减少人工干预,提高生产效率。 其他说明:文中提供了大量具体的编程实例和参数配置指南,有助于读者快速掌握相关技能并应用于实际工作中。同时提醒读者注意一些常见的错误及其解决方案,帮助规避潜在的风险。
内容概要:本文详细介绍了西门子PLC中用于电机控制的封装功能块,涵盖正转、反转、变频控制等多种功能。通过简化底层代码,提高编程效率和系统可靠性。文章展示了如何使用功能块实现正转、反转、变频控制、模拟量处理、故障处理等功能,并结合用户自定义数据类型(UDT)和多重背景技术,实现对大量电机的高效管理。此外,还提供了具体的代码示例,帮助读者更好地理解和应用这些功能块。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是那些需要频繁处理电机控制任务的人群。 使用场景及目标:适用于需要简化电机控制编程、提高系统可靠性和可维护性的工业环境。主要目标是减少重复编码的工作量,提升开发效率,确保系统稳定运行。 其他说明:文中提供的代码示例和方法不仅有助于初学者快速入门,也为有经验的工程师提供了优化现有系统的思路。通过使用这些功能块,可以在短时间内完成复杂电机控制系统的搭建和调试。
全球腐败感知数据(2000-2023)——3000行 33个指标 关于数据集 该数据集包含3000行和33列,涵盖了2000年至2023年的腐败感知指数(CPI)数据和各种治理指标。它包括国家排名、分数和其他指标,如公共部门腐败、司法腐败、贿赂指数、商业道德、民主指数、法治、政府效率、经济指标和人类发展指数。 这些数据可用于: 腐败趋势分析 腐败对GDP、人类发展指数和治理的影响 跨国比较 数据可视化和机器学习模型 该数据集对研究人员、数据分析师、政策制定者和对研究全球腐败趋势非常有用。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
内容概要:本文档详细介绍了将贝叶斯优化应用于FBCCA(滤波器组公共空间模式)参数调整的完整解决方案,包括代码实现和优化流程。首先,通过MNE库加载并预处理EEG数据,进行7-30Hz的预滤波处理,提取相关事件片段。接着,定义了FBCABayesianOptimizer类,该类包含创建动态滤波器组、获取模型参数以及定义优化目标函数的方法。其中,参数空间由离散和连续参数组成,涵盖了滤波器数量、CSP组件数、起始频率、带宽、交叠率等,并通过Optuna库进行多维搜索。优化过程中采用5折交叉验证机制,同时引入智能早停策略以提高效率。最后,提供了优化结果的可视化工具,如优化轨迹图、参数重要性图和滤波器组配置图,帮助用户更好地理解和分析优化过程。 适合人群:具有一定编程基础,尤其是对机器学习、脑电数据分析及贝叶斯优化感兴趣的科研人员和技术开发者。 使用场景及目标:①通过动态滤波器组生成算法,捕捉频段间的过渡特征;②利用混合参数空间设计,探索不同参数组合的效果;③借助高效交叉验证机制和智能早停策略,提高优化效率;④通过可视化工具,直观展示优化过程和结果。 阅读建议:此资源不仅展示了完整的代码实现,还深入探讨了FBCCA参数调整的理论基础和实际应用。建议读者在学习过程中结合理论知识与代码实践,逐步理解每个步骤的原理,并尝试调整参数以观察不同设置对优化效果的影响。同时,可根据自身硬件条件,考虑扩展建议中的GPU加速、分布式优化和在线学习等高级特性。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
街道级行政区划shp数据,wgs84坐标系,直接使用。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
街道级行政区划shp数据,wgs84坐标系,直接下载使用。
Matlab领域上传的视频是由对应的完整代码运行得来的,完整代码皆可运行,亲测可用,适合小白; 1、从视频里可见完整代码的内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
电子信息工程专业毕业论文模板_基于FPGA的CRC编码器设计.pdf
鄂尔多斯市-达拉特旗-街道行政区划_150621_Shp数据-wgs84坐标系.rar
内容概要:本文详细介绍了STM32与三菱PLC FX系列整合方案,涵盖多种功能模块的实现方法及其应用场景。首先,通过寄存器级别的低层操作展示了数码管驱动、模拟量采集、定时器PWM配置等功能的具体实现方式。其次,针对定位功能进行了深入探讨,包括12轴运动控制、4路200kHz高速脉冲输出以及CAN总线扩展等高级特性。此外,文中提供了三种不同层次的代码版本供开发者选择,分别是寄存器版本、库函数版本和即将发布的HAL库版本,满足不同程度用户的开发需求。最后,强调了该方案在工业控制领域的广泛应用前景,如包装机械、立体仓库等。 适合人群:具有一定嵌入式开发经验的研发人员,尤其是对STM32和三菱PLC有研究兴趣的技术爱好者。 使用场景及目标:适用于需要将STM32与三菱PLC进行深度整合的工程项目,旨在提高工业控制系统的灵活性和功能性。具体目标包括但不限于实现高效的梯形图上传下载、在线监控、多轴运动控制、模拟量采集及CAN总线通信等功能。 其他说明:文中不仅提供了详细的代码示例和技术细节,还分享了一些实用技巧,如寄存器操作注意事项、库函数的优势以及未来HAL库版本的发展方向。对于希望深入了解STM32与三菱PLC整合方案的读者而言,是一份不可多得的学习资料。
内容概要:本文详细介绍了西门子S7-200SMART PLC与V20变频器通过Modbus RTU进行通讯的具体实施方案,涵盖硬件接线、变频器参数设置、PLC程序编写以及触摸屏配置等方面的内容。重点解决了断电自恢复的问题,确保系统在断电重启后能够自动恢复正常运行。文中还提供了多个调试技巧和常见问题解决方案,如RS485接线注意事项、波特率设置、Modbus地址映射等。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是熟悉PLC和变频器应用的专业人士。 使用场景及目标:适用于需要将PLC与变频器集成的应用场合,特别是在电力供应不稳定或存在突发断电风险的环境中。目标是提高系统的稳定性和可靠性,减少人工干预,提升生产效率。 其他说明:文中提到的实际案例表明,该方案已在多个工业现场成功应用并长期稳定运行,证明了其可行性和优越性。此外,作者还分享了一些个人经验教训,帮助读者避免常见的错误和陷阱。
内容概要:本文详细介绍了基于西门子200PLC的全自动不锈钢焊接系统的程序设计及其配套的维纶触摸屏程序。项目采用了模块化设计,分为多个功能块如故障处理(FB_FaultHandling)、复位(FB_Reset)、自动模式(FB_AutoMode)和手动模式(FB_ManualMode),每个功能块职责明确,便于维护和复用。此外,还包括详细的地址分配表、电路原理图以及触摸屏界面设计,确保了系统的通用性和可维护性。文中还特别强调了故障处理模块的堆栈设计、安全回路的双冗余设计以及焊接参数的自动化计算等功能,展示了工业控制领域的最佳实践。 适合人群:从事PLC编程、工业自动化控制、机械设备维护的技术人员和工程师。 使用场景及目标:适用于需要设计和实施全自动焊接系统的工程项目,旨在提高生产效率、减少故障停机时间、优化焊接质量。通过学习本文,读者可以掌握模块化编程技巧、故障处理方法以及人机交互界面设计的最佳实践。 其他说明:本文不仅提供了具体的代码实现和电路图,还分享了许多实际调试经验和优化建议,帮助读者更好地理解和应用这些技术和方法。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
街道级行政区划shp数据,wgs84坐标系,直接下载使用。
街道级行政区划shp矢量数据,wgs84坐标系,下载直接使用
内容概要:本文详细介绍了使用台达DVP14ES PLC控制三台西门子V20变频器的自动化控制系统的设计与实现。主要内容涵盖硬件接线、变频器参数设置、PLC程序编写、频率设定、加减速时间配置以及断电自恢复机制等方面。文中特别强调了Modbus通讯的关键配置和技术难点,如RS485通讯线路的正确连接、变频器参数的精确设置、PLC轮询机制的应用、频率设定的浮点数转换、加减速时间的32位寄存器处理,以及断电自恢复的心跳检测和自动重启逻辑。此外,还提到了触摸屏交互设计和调试技巧,确保系统的稳定性和可靠性。 适合人群:从事工业自动化控制领域的工程师和技术人员,尤其是对PLC和变频器通讯有一定了解的从业者。 使用场景及目标:适用于需要构建稳定可靠的多品牌设备联动自动化控制系统的工厂和企业。主要目标是提高生产线的自动化程度,减少人工干预,提升生产效率和稳定性。 其他说明:文中提供了详细的代码示例和参数配置指南,帮助读者更好地理解和应用相关技术。同时,分享了许多实战经验和调试技巧,有助于解决实际工程中常见的问题。