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