資源簡介
WInform LED 時鐘顯示源碼及Dll C#控件源碼

代碼片段和文件信息
using?System;
using?System.Drawing;
using?System.Drawing.Drawing2D;
using?System.Globalization;
using?System.Windows.Forms;?
using?System.ComponentModel;
namespace?Clock
{
????///?
????///?Clock‘s?style.時鐘的樣式定義
????///?
????public?enum?SevenSegmentClockstyle
????{
????????DateOnly?//?只顯示日期
????????TimeOnly?//?只顯示時間
????????DateAndTime?//顯示日期和時間
????}
????//這是控件的關鍵代碼
????public?partial?class?SevenSegmentClock?:?UserControl
????{
????????DateTime?_dateTime;
????????//默認使用同時繪制日期和時間
????????SevenSegmentClockstyle?_clockstyle?=?SevenSegmentClockstyle.DateAndTime;
????????Color?_clockColor?=?Color.Red;
????????//是否繪制陰影(即殘影),以摸擬真似的LED時鐘
????????bool?_isDrawShadow?=?true;
????????Timer?_timer?=?null;
????????//是否自動更新時間
????????bool?_isTimerEnable?=?true;
????????Graphics?g?=?null;
????????Bitmap?m_Bitmap?=?null;
????????public?bool?IsDrawShadow
????????{
????????????get?{?return?this._isDrawShadow;?}
????????????set
????????????{
????????????????this._isDrawShadow?=?value;
????????????????this.Invalidate();
????????????}
????????}
????????[Browsable(false)]
????????public?System.Windows.Forms.Timer?Timer
????????{
????????????get?{?return?this._timer;?}
????????????set
????????????{
????????????????this._timer?=?value;
????????????????if?(_timer?!=?null)
????????????????{
????????????????????_timer.Tick?+=?new?EventHandler(TimerOnTick);
????????????????}
????????????}
????????}
????????public?bool?IsTimerEnable
????????{
????????????get?{?return?this._isTimerEnable;?}
????????????set
????????????{
????????????????if?(value?==?true)
????????????????{
????????????????????if?(this._timer?==?null)
????????????????????{
????????????????????????_timer?=?new?Timer();
????????????????????????_timer.Tick?+=?new?EventHandler(TimerOnTick);
????????????????????????_timer.Interval?=?1000;
????????????????????????_timer.Enabled?=?true;
????????????????????}
????????????????}
????????????????else
????????????????{
????????????????????if?(this._timer?!=?null)
????????????????????{
????????????????????????_timer.Enabled?=?false;
????????????????????}
????????????????}
????????????????this._isTimerEnable?=?value;
????????????}
????????}
????????public?void?Start()
????????{
????????????this.IsTimerEnable?=?true;
????????????this.Refresh();
????????}
????????public?void?Stop()
????????{
????????????this.IsTimerEnable?=?false;
????????}
????????public?System.DateTime?DateTime
????????{
????????????get?{?return?this._dateTime;?}
????????????set?{?this._dateTime?=?value;?}
????????}
????????//LED文字的顏色
????????public?System.Drawing.Color?ClockColor
????????{
????????????get?{?return?this._clockColor;?}
????????????set
????????????{
????????????????this._clockColor?=?value;
????????????????this.Invalidate();
????????????}
????????}
????????public?SevenSegmentClockstyle?SevenSegmentClockstyle
????????{
????????????get?{?return
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????24576??2011-05-11?14:35??Clock\Clock\bin\Debug\Clock.dll
?????文件??????28160??2011-05-11?14:35??Clock\Clock\bin\Debug\Clock.pdb
?????文件???????2557??2011-05-11?14:23??Clock\Clock\Clock.csproj
?????文件????????484??2011-05-11?14:35??Clock\Clock\obj\Clock.csproj.FileListAbsolute.txt
?????文件????????781??2011-05-11?14:35??Clock\Clock\obj\Debug\Clock.csproj.GenerateResource.Cache
?????文件??????24576??2011-05-11?14:35??Clock\Clock\obj\Debug\Clock.dll
?????文件??????28160??2011-05-11?14:35??Clock\Clock\obj\Debug\Clock.pdb
?????文件????????180??2011-05-11?14:35??Clock\Clock\obj\Debug\Clock.SevenSegmentClock.resources
?????文件???????1309??2011-05-11?13:56??Clock\Clock\Properties\AssemblyInfo.cs
?????文件???????8220??2011-05-11?14:29??Clock\Clock\SevenSegmentClock.cs
?????文件????????683??2011-05-11?14:23??Clock\Clock\SevenSegmentClock.Designer.cs
?????文件???????5814??2011-05-11?14:23??Clock\Clock\SevenSegmentClock.resx
?????文件???????6221??2011-05-11?14:21??Clock\Clock\SevenSegmentDisplay.cs
?????文件????????904??2011-05-11?13:56??Clock\Clock.sln
????..A..H.?????11776??2011-05-11?14:35??Clock\Clock.suo
?????目錄??????????0??2011-05-11?14:11??Clock\Clock\obj\Debug\Refactor
?????目錄??????????0??2011-05-11?13:56??Clock\Clock\obj\Debug\TempPE
?????目錄??????????0??2011-05-11?14:35??Clock\Clock\bin\Debug
?????目錄??????????0??2011-05-11?14:35??Clock\Clock\obj\Debug
?????目錄??????????0??2011-05-11?14:11??Clock\Clock\bin
?????目錄??????????0??2011-05-11?14:35??Clock\Clock\obj
?????目錄??????????0??2011-05-11?13:56??Clock\Clock\Properties
?????目錄??????????0??2011-05-11?14:29??Clock\Clock
?????目錄??????????0??2011-05-11?13:56??Clock
-----------?---------??----------?-----??----
???????????????144401????????????????????24
評論
共有 條評論