I have a RichTextBox
that is a letterbox view of a long set of data. This means I have the vertical scroll bar to move what I see up and down. What I am trying to do is save the whole data as a bitmap even that not visible in the control. I can save the control as a bitmap but that is only part of the data.
Code to save control is borrowed from someone else which does indeed save the control view (thanks to whoever wrote it):
private void btn_SaveBitmap_Click(object sender, EventArgs e)
{
SaveControlToBitmap(rchtxtbx_braille, "MyBitmap.bmp");
}
public void SaveControlToBitmap(Control control, string fileName)
{
//Get graphics from the control
Graphics g = control.CreateGraphics();
Bitmap bitmap = new Bitmap(control.Width, control.Height);
control.DrawToBitmap(bitmap, new Rectangle(0, 0, control.Width, control.Height));
bitmap.Save(fileName);
bitmap.Dispose();
}
This bitmap does not contain the data that is not visible in the control. I think somehow I need to find the start of the data and the end and turn that into a bitmap rather than turning the control itself into a bitmap but I am probably wrong. How can I do this please?
I have my laptops display set to 125% and this in itself may cause some issue. Please ask if this is not clear and I will try explain different way.