ab56a9bcf7
SVN-Revision: r240
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Drawing.Drawing2D;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms.Design;
|
|
|
|
namespace Lskj.Control.ImageLibrary
|
|
{
|
|
/// <summary>
|
|
/// 绘制虚线边框
|
|
/// </summary>
|
|
[Description("绘制虚线边框")]
|
|
public class DottedLineBorderExtDesigner : ControlDesigner
|
|
{
|
|
protected override void OnPaintAdornments(PaintEventArgs pe)
|
|
{
|
|
base.OnPaintAdornments(pe);
|
|
this.DrawBorder(pe.Graphics);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绘制虚线边框
|
|
/// </summary>
|
|
/// <param name="graphics"></param>
|
|
private void DrawBorder(Graphics graphics)
|
|
{
|
|
System.Windows.Forms.Control control = this.Control;
|
|
Rectangle clientRectangle = control.ClientRectangle;
|
|
Pen pen = new Pen((double)control.BackColor.GetBrightness() >= 0.5 ? ControlPaint.Dark(control.BackColor) : ControlPaint.Light(control.BackColor));
|
|
pen.DashStyle = DashStyle.Dash;
|
|
--clientRectangle.Width;
|
|
--clientRectangle.Height;
|
|
graphics.DrawRectangle(pen, clientRectangle);
|
|
pen.Dispose();
|
|
}
|
|
}
|
|
}
|