Click here to Skip to main content
12,623,903 members (27,265 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
Hey I have a large panel in Ribbon Application , size of a page and it contains many other controls and a richtextbox. However DrawToBitmap is not working properly for richtextbox. I searched a little but it seems i have to print the screen. But i can't print because the page is a little big.
So is there another way to draw my panel with the richtextbox?

I am using this code.

OuterPages outer=new OuterPages();
//OuterPage is a class that contaings the panel TesPage and many controls in it //including RichTextBox.
       public void DrawControl(Control control, Bitmap bitmap)
            control.DrawToBitmap(bitmap, control.Bounds);
            foreach (Control childControl in control.Controls)
                DrawControl(childControl, bitmap);
        public void SaveBitmap()
            Rectangle rc = new Rectangle(0, 0, outer.TestPage.Width, outer.TestPage.Height);
            Bitmap bmp = new Bitmap(outer.TestPage.Width, outer.TestPage.Height);
            outer.TestPage.DrawToBitmap(bmp, rc);
            foreach (Control control in outer.TestPage.Controls)
                DrawControl(control, bmp);
          //  outer.TitleRichTextBox.DrawToBitmap(bmp, rc);  This is not working.

Posted 2-Feb-13 12:03pm
Updated 8-Feb-13 1:21am
Why?! And what is "not working properly", exactly?
missak boyajian 7-Feb-13 15:11pm
RichTextBox does not have DrawToBitmap method. How can I draw it?
missak boyajian 3-Feb-13 5:58am
The text is not showing. It is just drawing the border.
This is not a complete code sample. What is, for example, outer? You could abstract it out, for example, some function without any unknown definitions, if not a complete project — the problem is simple enough.
Is it System.Windows.Forms? Always tag your UI library or application type...
missak boyajian 8-Feb-13 6:25am
It's ribbon application. I have download it from component one studio. I improved the question. If still not enough I can improve it.
CHill60 8-Feb-13 11:19am
Have a look at this link

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100