在.NET 2中创建类似控件的信息框

时间:2010-07-04 15:00:24

标签: c# .net winforms controls

我想在.net 2中创建一个信息框(附图是带有示例的图片)alt text http://www.freeimagehosting.net/image.php?2d46ae8c2e.jpg 我想使用面板,但我无法改变其边框的颜色。

是否可以更改此属性?如果是这样,怎么样?

谢谢, Shuky alt text http://i48.tinypic.com/rm371g.jpg

1 个答案:

答案 0 :(得分:2)

您不能直接更改边框的颜色,但是,您可以使用任何颜色和样式绘制自己的颜色。请参阅this article

文章中的代码示例。 (这就是你所需要的。)

private void panel1_Paint(object sender, PaintEventArgs e)     {
    ControlPaint.DrawBorder(e.Graphics, this.panel1.ClientRectangle, 
    Color.DarkBlue, ButtonBorderStyle.Solid);
}

private void panel1_Resize(object sender, EventArgs e)
{
    Invalidate();
}