5 个解决方案
#1
GDI+,很简单,看看书就会。
#2
从我的程序中摘录出来的,有删除,有点乱,你参考一下吧
Bitmap nbmp = new Bitmap(nw, nh);
Graphics g = Graphics.FromImage(nbmp);
g.Clear(p.kColor);
g.DrawImage(bmp, new Rectangle(0, 0, nw, nh), nr, GraphicsUnit.Pixel);
bmp.Dispose();
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
StringFormat sf = new StringFormat();
sf.FormatFlags = StringFormatFlags.FitBlackBox;
Brush brush = new SolidBrush(Color.White);
g.DrawString("文字", font, new SolidBrush(Color.Gray), new Rectangle(m + 4, m + 4, nw, nh), sf);
g.Dispose();
PictureBox1.Image=nbmp;
Bitmap nbmp = new Bitmap(nw, nh);
Graphics g = Graphics.FromImage(nbmp);
g.Clear(p.kColor);
g.DrawImage(bmp, new Rectangle(0, 0, nw, nh), nr, GraphicsUnit.Pixel);
bmp.Dispose();
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
StringFormat sf = new StringFormat();
sf.FormatFlags = StringFormatFlags.FitBlackBox;
Brush brush = new SolidBrush(Color.White);
g.DrawString("文字", font, new SolidBrush(Color.Gray), new Rectangle(m + 4, m + 4, nw, nh), sf);
g.Dispose();
PictureBox1.Image=nbmp;
#3
new Rectangle(m + 4, m + 4, nw, nh),这部分是坐标吗
#4
还有你的Nw,Nh都是怎么声明的啊
#5
nw ,nh 是新的图片的宽度及高度
#1
GDI+,很简单,看看书就会。
#2
从我的程序中摘录出来的,有删除,有点乱,你参考一下吧
Bitmap nbmp = new Bitmap(nw, nh);
Graphics g = Graphics.FromImage(nbmp);
g.Clear(p.kColor);
g.DrawImage(bmp, new Rectangle(0, 0, nw, nh), nr, GraphicsUnit.Pixel);
bmp.Dispose();
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
StringFormat sf = new StringFormat();
sf.FormatFlags = StringFormatFlags.FitBlackBox;
Brush brush = new SolidBrush(Color.White);
g.DrawString("文字", font, new SolidBrush(Color.Gray), new Rectangle(m + 4, m + 4, nw, nh), sf);
g.Dispose();
PictureBox1.Image=nbmp;
Bitmap nbmp = new Bitmap(nw, nh);
Graphics g = Graphics.FromImage(nbmp);
g.Clear(p.kColor);
g.DrawImage(bmp, new Rectangle(0, 0, nw, nh), nr, GraphicsUnit.Pixel);
bmp.Dispose();
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
StringFormat sf = new StringFormat();
sf.FormatFlags = StringFormatFlags.FitBlackBox;
Brush brush = new SolidBrush(Color.White);
g.DrawString("文字", font, new SolidBrush(Color.Gray), new Rectangle(m + 4, m + 4, nw, nh), sf);
g.Dispose();
PictureBox1.Image=nbmp;
#3
new Rectangle(m + 4, m + 4, nw, nh),这部分是坐标吗
#4
还有你的Nw,Nh都是怎么声明的啊
#5
nw ,nh 是新的图片的宽度及高度