// ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-10-15
//
// ***********************************************************************
//
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
//
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
///
/// Class UCPanelQuote.
/// Implements the
///
///
public class UCPanelQuote : Panel
{
///
/// The border color
///
private Color borderColor = LineColors.Light;
///
/// Gets or sets the color of the border.
///
/// The color of the border.
[Description("边框颜色"), Category("自定义")]
public Color BorderColor
{
get { return borderColor; }
set
{
borderColor = value;
this.Invalidate();
}
}
///
/// The left color
///
private Color leftColor = StatusColors.Danger;
///
/// Gets or sets the color of the left.
///
/// The color of the left.
[Description("左侧颜色"), Category("自定义")]
public Color LeftColor
{
get { return leftColor; }
set
{
leftColor = value;
this.Invalidate();
}
}
///
/// Initializes a new instance of the class.
///
public UCPanelQuote()
: base()
{
Padding = new Padding(5, 1, 1, 1);
}
///
/// 引发 事件。
///
/// 包含事件数据的 。
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.SetGDIHigh();
e.Graphics.DrawLines(new Pen(borderColor), new Point[]
{
new Point(e.ClipRectangle.Left,e.ClipRectangle.Top),
new Point(e.ClipRectangle.Right-1,e.ClipRectangle.Top),
new Point(e.ClipRectangle.Right-1,e.ClipRectangle.Bottom-1),
new Point(e.ClipRectangle.Left,e.ClipRectangle.Bottom-1),
new Point(e.ClipRectangle.Left,e.ClipRectangle.Top)
});
e.Graphics.FillRectangle(new SolidBrush(leftColor), new Rectangle(0, 0, 5, this.Height));
}
}
}