资源简介
winform项目,动态显示红绿灯,功能较简单,代码易懂,希望给大家带来点帮助。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace Ex19_13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//重写
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
getFillColor();//
}
//自定义绘制红绿黄灯方法一个填冲函数
public void getFillColor()
{
Graphics g = this.CreateGraphics();//实例一个 Graphics对像
switch (intFalg)
{
case 0:
g.FillEllipse(Brushes.DarkBlue 20 8 60 60);
g.FillEllipse(Brushes.DarkBlue 110 8 60 60);
g.FillEllipse(Brushes.DarkBlue 200 8 60 60);
break;
case 1:// //红灯
g.FillEllipse(Brushes.Red 20 8 60 60);
g.FillEllipse(Brushes.DarkBlue 110 8 60 60);
g.FillEllipse(Brushes.DarkBlue 200 8 60 60);
break;
case 2: //绿灯
g.FillEllipse(Brushes.DarkBlue 20 8 60 60);
g.FillEllipse(Brushes.DarkBlue 110 8 60 60);
g.FillEllipse(Brushes.Green 200 8 60 60);
break;//
case 3:
g.FillEllipse(Brushes.DarkBlue 20 8 60 60);
g.FillEllipse(Brushes.Yellow 110 8 60 60);
g.FillEllipse(Brushes.DarkBlue 200 8 60 60);
break;////黄灯
}//end switch
}//
private void Form1_Load(object sender EventArgs e)
{
intTime=65;
label1.Text = intTime.ToString();
label1.ForeColor = Color.Red;
timer1.Enabled=true;
}
public int intTime = 0;// 计时
public int intFalg = 0;//标记
// 红灯
private void timer1_Tick(object sender EventArgs e)
{
Graphics g = this.CreateGraphics();
if (intTime != 0)
{
if (intTime < 10)
{
label1.Text = “0“ + intTime.ToString();
label1.ForeColor = Color.Red;
}
else
{
label1.Text = intTime.ToString();
label1.ForeColor = Color.Red;
}
intTime--;
intFalg = 1;//控制红绿黄灯刷新
getFillColor();//调用填冲函数
}
else
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 20480 2008-11-13 20:13 Ex19_13\Ex19_13\bin\Debug\Ex19_13.exe
文件 30208 2008-11-13 20:13 Ex19_13\Ex19_13\bin\Debug\Ex19_13.pdb
文件 5632 2007-07-11 11:35 Ex19_13\Ex19_13\bin\Debug\Ex19_13.vshost.exe
文件 3221 2007-07-11 11:35 Ex19_13\Ex19_13\Ex19_13.csproj
文件 5523 2007-07-11 11:35 Ex19_13\Ex19_13\Form1.cs
文件 3226 2007-07-11 11:35 Ex19_13\Ex19_13\Form1.Designer.cs
文件 6398 2007-07-11 11:35 Ex19_13\Ex19_13\Form1.resx
文件 842 2008-11-13 20:13 Ex19_13\Ex19_13\obj\Debug\Ex19_13.csproj.GenerateResource.Cache
文件 20480 2008-11-13 20:13 Ex19_13\Ex19_13\obj\Debug\Ex19_13.exe
文件 180 2008-11-13 20:13 Ex19_13\Ex19_13\obj\Debug\Ex19_13.Form1.resources
文件 30208 2008-11-13 20:13 Ex19_13\Ex19_13\obj\Debug\Ex19_13.pdb
文件 180 2008-11-13 20:13 Ex19_13\Ex19_13\obj\Debug\Ex19_13.Properties.Resources.resources
文件 842 2007-07-11 11:35 Ex19_13\Ex19_13\obj\Debug\Ex20_13.csproj.GenerateResource.Cache
文件 180 2007-07-11 11:35 Ex19_13\Ex19_13\obj\Debug\Ex20_13.Form1.resources
文件 180 2007-07-11 11:35 Ex19_13\Ex19_13\obj\Debug\Ex20_13.Properties.Resources.resources
文件 268 2007-07-11 11:35 Ex19_13\Ex19_13\obj\Ex19_13.csproj.FileList.txt
文件 532 2008-11-13 20:13 Ex19_13\Ex19_13\obj\Ex19_13.csproj.FileListAbsolute.txt
文件 268 2007-07-11 11:35 Ex19_13\Ex19_13\obj\Ex20_13.csproj.FileList.txt
文件 466 2007-07-11 11:35 Ex19_13\Ex19_13\Program.cs
文件 1162 2007-07-11 11:35 Ex19_13\Ex19_13\Properties\AssemblyInfo.cs
文件 2868 2007-07-11 11:35 Ex19_13\Ex19_13\Properties\Resources.Designer.cs
文件 5612 2007-07-11 11:35 Ex19_13\Ex19_13\Properties\Resources.resx
文件 1090 2007-07-11 11:35 Ex19_13\Ex19_13\Properties\Settings.Designer.cs
文件 249 2007-07-11 11:35 Ex19_13\Ex19_13\Properties\Settings.settings
文件 910 2007-07-11 11:35 Ex19_13\Ex19_13.sln
..A..H. 19968 2008-11-13 20:13 Ex19_13\Ex19_13.suo
文件 20480 2007-07-11 11:35 Ex19_13\Ex20_13\bin\Debug\Ex20_13.exe
文件 32256 2007-07-11 11:35 Ex19_13\Ex20_13\bin\Debug\Ex20_13.pdb
文件 5658 2007-07-11 11:35 Ex19_13\Ex20_13\bin\Debug\Ex20_13.vshost.exe
文件 3221 2007-07-11 11:35 Ex19_13\Ex20_13\Ex20_13.csproj
............此处省略35个文件信息
- 上一篇:ASP.NET/C# +SQL小区收费系统
- 下一篇:c#Form窗体增删改操作
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- Winform可视化打印模板设计工具含源码
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论