Controls/UAlarm.cs

(开头部分) 4KB

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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WarningAndMonitingSystem.Controls
{
    public partial class UAlarm : UserControl
    {
        private Rectangle workArea;
        private System.Timers.Timer timer;

        public UAlarm()
        {
            InitializeComponent();
            SetStyle(ControlStyles.AllPaintingInWmPaint,true);
            SetStyle(ControlStyles.UserPaint,true);
            SetStyle(ControlStyles.ResizeRedraw,true);
            SetStyle(ControlStyles.SupportsTransparentBackColor,true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer,true);
            SetStyle(ControlStyles.Selectable, true);

            this.SizeChanged += UAlarm_SizeChanged;
            this.Size = new Size(50, 50);

            // 初始化定时器
            timer = new System.Timers.Timer();
            timer.AutoReset = true;
            timer.Interval = 200;
            timer.Elapsed += Timer_Elapsed;
        }

        private int colorIdx = 0;

        private void Timer_Elapsed(object? sender, System.Timers.ElapsedEventArgs e)
        {
            this.Invoke(new Action(() =>
            {
                colorIdx++;
                if (colorIdx >= lightColors.Length)
                {
                    colorIdx = 0;
                }
                Invalidate();
            }));
        }

        private void UAlarm_SizeChanged(object? sender, EventArgs e)
        {
            workArea = new Rectangle(Width / 8,Height / 8, Width / 4 *3,Height / 4 * 3);
        }

        private Color standColor = Color.DarkGray;
        [Category("自定义属性")]
后面还有 115 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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