[C#] 纯文本查看 复制代码 public Image getProgress()
{
double pro = (double)uploaded / file.Length * 170;
Bitmap progress = new Bitmap(170, 60);
Graphics graphics = Graphics.FromImage(progress);
graphics.Clear(Color.Transparent);
//graphics.FillRectangle(Brushes.Red, 0, 0, (float)pro, 8f);
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
graphics.DrawString(this.ToString(), new Font("黑体", 7), Brushes.Red, new PointF(10, 1));
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
graphics.DrawString(this.ToString(), new Font("黑体", 7), Brushes.Red, new PointF(10, 10));
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
graphics.DrawString(this.ToString(), new Font("黑体", 7), Brushes.Red, new PointF(10, 20));
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
graphics.DrawString(this.ToString(), new Font("黑体", 7), Brushes.Red, new PointF(10, 30));
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
graphics.DrawString(this.ToString(), new Font("黑体", 7), Brushes.Red, new PointF(10, 40));
graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
graphics.DrawString(this.ToString(), new Font("黑体", 7), Brushes.Red, new PointF(10, 50));
graphics.Flush();
return progress;
}
已解决!真是已发帖就能早到解决办法!不发一上午都找不到
|