C#:绘图问题

1、设置DPI

Bitmap bitmap2 = new Bitmap((int)w, (int)h);
bitmap2.SetResolution(, );

2、设置Graphic(如:去锯齿等)

        private Graphics GetG(Bitmap bitmap)
{
Graphics g = Graphics.FromImage(bitmap);
//设置高质量插值法
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
//如何将图片覆盖到G
g.CompositingMode = CompositingMode.SourceOver;
//图片呈现质量
g.CompositingQuality = CompositingQuality.HighQuality;
//文字抗锯齿
g.TextRenderingHint = TextRenderingHint.AntiAlias;
//设置高质量,低速度呈现平滑程度
g.SmoothingMode = SmoothingMode.AntiAlias;
//设置背景颜色
g.Clear(Color.White); return g;
}

3、保存绘制的图片

if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
this.pictureBox1.Image.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png);
}
上一篇:vs2013 vs2017和sqlserver localdb环境下解决IIS调试问题


下一篇:visual studio 2017安装教程以及各类问题解决方案