日期:2014-05-17 浏览次数:20788 次
public MyTransparentControl()
{
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor
| ControlStyles.UserPaint
| ControlStyles.AllPaintingInWmPaint
| ControlStyles.Opaque, true);
base.CreateControl();
this.BringToFront();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
for (int i = 0; i < this.Width; i += 100)//画线
{
e.Graphics.DrawLine(new Pen(Color.Gray), new Point(i + 50, 0), new Point(i, this.Height - 1));
}
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style |= 0x00000020;
//WS_EX_TRANSPARENT