【发布时间】:2013-10-05 22:34:54
【问题描述】:
我使用下面的代码为窗口窗体中的按钮设置渐变。它有效,但它的文本没有显示。我应该怎么做才能修复它? 谢谢。
private void Form1_Load(object sender, EventArgs e)
{
button2.Paint += new PaintEventHandler(this.Button2_Paint);
}
private void Button2_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(PointF.Empty, new PointF(button2.Width, button2.Height), Color.Pink, Color.Red), new RectangleF(PointF.Empty, button2.Size));
}
【问题讨论】: