Controls/UButton.cs

(开头部分) 6KB

这里只显示每个文件的开头 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 AirConditionControl.Controls
{
    public partial class UButton : UserControl
    {

        public UButton()
        {
            InitializeComponent();

            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.Selectable, true);

            this.Size = new Size(100, 40);
            this.Cursor = Cursors.Hand;
            this.BackColor = Color.Transparent;
            this.Font = new Font("微软雅黑", 9, FontStyle.Bold);
            this.AutoSize = true;
            Click += UButton_Click;
        }

        private void UButton_Click(object? sender, EventArgs e)
        {
            IsCheck = !IsCheck;
        }

        private string content = "已关闭";

        // 按钮是否选中
        private bool isCheck = false;
        [Category("自定义属性")]
        [Description("按钮是否选中")]
        public bool IsCheck
        {
            get { return isCheck; }
            set
            {
                isCheck = value;
                if (isCheck)
                {
                    content = "已开启";
                }
                else
                {
                    content = "已关闭";
                }
后面还有 139 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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