Item/Head/HeadCheckBox.cs

(开头部分) 2KB

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

using HostsEditor.Item;
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;

namespace HostsEditor.Controls.Head
{
    public class HeadCheckBox : Container
    {
        readonly int ElementWidth = 45;

        // 元素位置
        Point ElementPoint
        {
            get
            {
                return new Point(ShareData.HeadSize.Width - ElementWidth - 3 - ShareData.RemoveButtonSize.Width, 0);
            }
        }

        /// <summary>
        /// 实例化并生成输入框组件
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        public CheckBox CreateElement(int id, string status)
        {
            CheckBox cb = new CheckBox
            {
                Name = BuildElementId(id),
                Width = ElementWidth,
                Height = ShareData.HeadSize.Height,
                Location = ElementPoint,
                AutoSize = false,
                FlatStyle = FlatStyle.System,
                Text = "启用",
                ForeColor = Color.FromArgb(255, 45, 45, 48),
                Checked = status == "active"
            };

            cb.CheckedChanged += Cb_CheckedChanged;

            return cb;
        }

        private void Cb_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox cb = (CheckBox)sender;

            string id = ParseIdByControl(cb);

            string name = string.Format("Item_Panel_{0}", id);

            Panel itemPanel = (Panel)Closest(cb, name);

            Control[] tbs = itemPanel.Controls.Find("Head_Content_" + id, true);
            Control[] tbs2 = itemPanel.Controls.Find("Body_Content_" + id, true);

            if (cb.Checked)
后面还有 20 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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