View/StopWatchUserControl.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace CustomTimers
{
    public partial class StopWatchUserControl : UserControl
    {
        //-----------------------------------------------
        // Private data members
        //-----------------------------------------------
        private StopWatchTimer _StopWatch = new StopWatchTimer ();
        private bool _IsStopClicked = false;

        //-----------------------------------------------
        // Public properties
        //-----------------------------------------------

        //-----------------------------------------------
        // Private member functions
        //-----------------------------------------------
        private void Init ()
        {
            _StopWatch.SynchronizingObject = this;
            _StopWatch.Elapsed += new
                EventHandler (_StopWatch_Elapsed);

            _StopWatch.StateChanged += new
                EventHandler (_StopWatch_StateChanged);

        }

        private void Reset ()
        {
            _StopWatch.Reset ();
            UpdateLabels ();
            UpdateInputs ();
            UpdateButtons ();
        }

        private void UpdateLabels ()
        {
            if (!_IsStopClicked)
            {
                lblHour.Text =
                    string.Format ("{0:00}", _StopWatch.Hour);
                lblMinute.Text =
                    string.Format ("{0:00}", _StopWatch.Minute);
                lblSecond.Text =
                    string.Format ("{0:00}", _StopWatch.Second);
                lblMillisecond.Text =
                    string.Format ("{0:000}", _StopWatch.Millisecond);
            }
        }

        private void UpdateInputs ()
后面还有 112 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。