日期:2014-05-17 浏览次数:20993 次
Graphics g = this.CreateGraphics();
g.Clear(Color.SeaShell);
Brush b = new SolidBrush(Color.Blue);
Pen p = new Pen(b,11);
p.Width = 12;
g.DrawLine(p, 100, 300, 100, 400);
public partial class CustomControl1 : TextBox
{
public CustomControl1()
{
InitializeComponent();
this.BorderStyle = BorderStyle.None;
this.BackColor = SystemColors.Control;
}
private int WM_PAINT = 0x000F;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_PAINT)
{
Pen pen = new Pen(Brushes.Olive, 1.5f);
using (Graphics g = this.CreateGraphics())
{
g.DrawLine(pen, new Point(0, this.Size.Height - 1), new Point(this.Size.Width, this.Size.Height - 1));
}
}
}
}<