• 大小: 33KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: C#
  • 标签: WInform  LED  

资源简介

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


评论

共有 条评论