Eabei.GoBangGame/Eabei.Controls/PanelControl.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Eabei.Controls
{
    public class PanelControl : Panel
    {
        public PanelControl()
        {
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.UserPaint, true);

            //this.BackColor = Color.FromArgb(0xff, 0xcc, 0x85, 0x2a);
            this.BackColor = Color.Transparent;
        }

        private byte _alpha = 0x40;
        [DefaultValue(0x40), Description("背景色的透明通道")]
        public byte Alpha { get => _alpha; set { _alpha = value; this.Invalidate(false); } }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(_alpha, 0x4f, 0x58, 0x50)), new Rectangle(0, 0, this.Width - 1, this.Height - 1));
        }

    }
}

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

AI 解读 AI

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

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