XP可用的GDI+发光字画法...
算法还能改进
public void Luminous(Graphics g, int Fuzzy, Rectangle Rect, string Text, Rectangle Textrect, Font Font, int FontColor, int ShadowColor)
{
Bitmap Bit1 = new Bitmap(Rect .Width , Rect .Height , System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics g1 = Graphics.FromImage(Bit1);
g1.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g1.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g1.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.AssumeLinear;
Bitmap Bit2 = new Bitmap(Rect.Width / Fuzzy, Rect.Height / Fuzzy, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics g2 = Graphics.FromImage(Bit2);
g2.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g2.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None;
//布局
int cb = ShadowColor / 65536;
int cg = (ShadowColor - cb* 65536) / 256;
int cr = ShadowColor - (cb * 65536) - (cg * 256);
SolidBrush B = new SolidBrush (Color .FromArgb (255,cr,cg,cb));
GraphicsPath path = new GraphicsPath();
path.AddString(Text, Font.FontFamily, (int)(FontStyle.Bold), Font.Size, Textrect , new StringFormat());
g1.FillPath(B, path);
path.Dispose();
//绘制文字
Auxiliary_Console.ts1(Fuzzy.ToString());
g2.DrawImage(Bit1 ,0,0,Rect .Width / Fuzzy ,Rect .Height /Fuzzy );
g1.Clear(Color .FromArgb (0));
g1.DrawImage(Bit2, 0, 0, Rect.Width, Rect.Height);
g1.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
//发光字底图
GraphicsPath path1 = new GraphicsPath();
path1.AddString(Text, Font.FontFamily, (int)(FontStyle.Bold), Font.Size, Textrect, new StringFormat());
cb = FontColor / 65536;
cg = (FontColor - cb * 65536) / 256;
cr = FontColor - (cb * 65536) - (cg * 256);
B.Color = Color.FromArgb(255, cr, cg, cb);
g1.FillPath(B, path1);
path.Dispose();
//绘制文字
g.DrawImage(Bit1, Rect.X, Rect.Y );
g1.Dispose();
g2.Dispose();
Bit1.Dispose();
Bit2.Dispose();
B.Dispose();
}//写发光字
[解决办法]
void Luminous(Graphics &g, int Fuzzy, Rect rectPaint, LPCWSTR Text, Rect Textrect, Font &TextFont, int FontColor, int ShadowColor)
{
Bitmap Bit1(rectPaint.Width, rectPaint.Height);
Graphics g1(&Bit1);
g1.SetSmoothingMode(SmoothingModeAntiAlias);
g1.SetTextRenderingHint(TextRenderingHintAntiAlias);
g1.SetCompositingQuality(CompositingQualityAssumeLinear);
Bitmap Bit2(rectPaint.Width / Fuzzy, rectPaint.Height/ Fuzzy);
Graphics g2(&Bit2);
g2.SetInterpolationMode(InterpolationModeHighQualityBicubic);
g2.SetPixelOffsetMode(PixelOffsetModeNone);
//布局
int cb = ShadowColor / 65536;
int cg = (ShadowColor - cb * 65536) / 256;
int cr = ShadowColor - (cb * 65536) - (cg * 256);
SolidBrush B(Color(255, cr, cg, cb));
GraphicsPath path;
FontFamily ftFamily;
TextFont.GetFamily(&ftFamily);
path.AddString(Text,-1,&ftFamily , (int)(FontStyleBold), TextFont.GetSize(), Textrect,NULL);
g1.FillPath(&B, &path);
//绘制文字
g2.DrawImage(&Bit1, 0, 0, rectPaint.Width/ Fuzzy, rectPaint.Height / Fuzzy);
g1.Clear(Color(0));
g1.DrawImage(&Bit2, 0, 0, rectPaint.Width, rectPaint.Height);
g1.SetTextRenderingHint(TextRenderingHintAntiAlias);
//发光字底图
GraphicsPath path1;
path1.AddString(Text,-1,&ftFamily, (int)(FontStyleBold),TextFont.GetSize(), Textrect,NULL/* new StringFormat()*/);
cb = FontColor / 65536;
cg = (FontColor - cb * 65536) / 256;
cr = FontColor - (cb * 65536) - (cg * 256);
B.SetColor(Color(255, cr, cg, cb));
g1.FillPath(&B, &path1);
//绘制文字
g.DrawImage(&Bit1, rectPaint.X, rectPaint.Y);
}