3
我正在制作一个简单的窗体,其中有两个半透明文本 ,我把它放在绘画事件中。只有当我扩大形式时,文字会变得更暗和颗粒感。 actualy我想要更深的颜色,但不是粒状效果。visual c# - onPaint和透明度
这里是我的代码片段:
private void sbfToolBox_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
string drawString = "tekst";
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 50);
Color color_red = Color.FromArgb(30, 100, 0, 0);
Color color_cyan = Color.FromArgb(30, 0, 100, 100);
System.Drawing.SolidBrush brush_red = new System.Drawing.SolidBrush(color_red);
System.Drawing.SolidBrush brush_cyan = new System.Drawing.SolidBrush(color_cyan);
float x = 0.0F;
float x2 = 20.0F;
float y = 50.0F;
formGraphics.DrawString(drawString, drawFont, brush_red, x, y);
formGraphics.DrawString(drawString, drawFont, brush_cyan, x2, y);
drawFont.Dispose();
brush_red.Dispose();
brush_cyan.Dispose();
formGraphics.Dispose();
}
在此先感谢
谢谢你,但我有一点点其他的问题,我做了一个函数从一个按钮调用,但在函数中,我需要e.Graphics如何创建一个新的? – ecross 2010-04-14 10:55:24