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.DrawString(this.ToString(), new Font("宋体", 13), Brushes.Red, new PointF(10, 15));
// 下面的部分
graphics.DrawString(this.ToString(), new Font("黑体", 13), Brushes.Red, new PointF(10, 30));
graphics.Flush();
return progress;
}
QQ图片20160421103106.png (5.55 KB, 下载次数: 37)
对比
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;
}
QQ图片20160421104519.png (6.51 KB, 下载次数: 38)
绘制对比
乔克斯 发表于 2016-4-21 10:51
= =噗。。下次请发到技术求助板块。
欢迎光临 CSkin博客 (http://bbs.cskin.net/) | Powered by Discuz! X3.2 |