If you need to save Win Form (or control in this example a Rich Text Box) as JPG file here is an example how to do it from the MDI parent menu:
// Determine the active child form.
Form activeChild = this.ActiveMdiChild;
if (activeChild is GraphViewWindow)
{
GraphViewWindow frm = activeChild as GraphViewWindow; }
// If there is an active child form, find the active control, which
// in this example should be a RichTextBox.
if (activeChild != null) {
try
{
RichTextBox theBox = (RichTextBox)activeChild.ActiveControl;
if (theBox != null)
{
Bitmap bmp = new Bitmap(theBox.Width, theBox.Height);
Graphics g = Graphics.FromImage(bmp);
Point myp = theBox.PointToScreen(new Point(0, 0));
Point myp1 = theBox.Location;
g.CopyFromScreen(myp, myp1, bmp.Size);
g.Dispose();
bmp.Save("FileName.jpg"); }
}
catch
{
MessageBox.Show("You need to select a Rich Text Box."); }
}