为了进行richtextbox的内容打印,我将richtextbox中的内容转化为一个Bitmap对象,然后用Graphics.DrawImage方法将Bitmap对象显示出来,但是图像显示出来后清晰度有点低。不明白为什么?
这是将richtextbox中的内容转化为图像的函数:
public Image GetShowImage(int width, int height)
{
Graphics gSrc = rtbDocument.CreateGraphics();
Bitmap bmp = new Bitmap(width, height);
Graphics g = Graphics.FromImage(bmp);
HandleRef hDcSave = new HandleRef(null, g.GetHdc());
HandleRef hDcSrc = new HandleRef(null, gSrc.GetHdc());
BitBlt(hDcSave, 0, 0, width, height, hDcSrc, 0, 0, SRCCOPY);
g.ReleaseHdc();
gSrc.ReleaseHdc();
return bmp;
}