⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qpanel.cs

📁 基于C/S的医疗卫生管理系统
💻 CS
字号:
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace Qeb.Control
{
    public partial class QPanel : System.Windows.Forms.Panel
    {
        private ViewStyle m_ViewStyle = ViewStyle.Standard;
        [Description("控件样式"), Category("控件样式")]
        public ViewStyle ControlStyle
        {
            get { return m_ViewStyle; }
            set { m_ViewStyle = value; }
        }

        //private Color m_StartColor = Color.FromArgb(181, 222, 255);
        //private Color m_EndColor = Color.FromArgb(198, 177, 222);
        //private Color m_StartColor = Color.FromArgb(196, 218, 250);
        //private Color m_EndColor = Color.FromArgb(158, 190, 245);
        private Color m_StartColor = Color.FromArgb(200, 223, 251);
        private Color m_EndColor = Color.FromArgb(125, 165, 224);
        private LinearGradientMode m_LinearGradientMode = LinearGradientMode.Vertical;

        [Description("渐变色绘制方向"), Category("控件样式")]
        public LinearGradientMode LinearGradientMode
        {
            get { return m_LinearGradientMode; }
            set { m_LinearGradientMode = value; }
        }

        [Description("渐变色开始颜色"), Category("控件样式")]
        public Color StartColor
        {
            get { return m_StartColor; }
            set { m_StartColor = value; }
        }

        [Description("渐变色终止颜色"), Category("控件样式")]
        public Color EndColor
        {
            get { return m_EndColor; }
            set { m_EndColor = value; }
        }

        public QPanel()
        {
            InitializeComponent();
        }

        public QPanel(IContainer container)
        {

            container.Add(this);

            InitializeComponent();
        }

        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
        {
            if (m_ViewStyle == ViewStyle.Custom)
            {
                base.OnPaintBackground(pevent);
            }
            else
            {
                if (this.Disposing) return;
                if (ClientRectangle.IsEmpty || ClientRectangle.Width == 0 || ClientRectangle.Height == 0) return;


                LinearGradientBrush linearGradientBrush = new LinearGradientBrush(ClientRectangle, m_StartColor, m_EndColor, m_LinearGradientMode);

                pevent.Graphics.FillRectangle(linearGradientBrush, ClientRectangle);
                pevent.Graphics.Flush();

                linearGradientBrush.Dispose();


            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -