coolgabber Posted June 21, 2006 Posted June 21, 2006 Hallo, i try to create a bitmap from a filled richtextbox in C#. Any idea? :rolleyes: Quote
Diesel Posted June 22, 2006 Posted June 22, 2006 http://www.mcwtech.com/CS/blogs/keng/archive/2005/12/16/137.aspx Quote
Leaders snarfblam Posted June 22, 2006 Leaders Posted June 22, 2006 I can guaruntee you that the first solution on the page you linked to won't work. RichTextBox does not support DrawToBitmap. I don't know why it isn't supported but I'm guessing that for the same reasons that RichTextBox doesn't support DrawToBitmap, the second solution might not work either. That's just a guess though. Quote [sIGPIC]e[/sIGPIC]
Leaders snarfblam Posted June 24, 2006 Leaders Posted June 24, 2006 No one said he made it up and no one said don't try it. His program will work just as he said, with the exception that the first method won't work with rtf boxes and the second may not work for rtf boxes. To me, "may not" implies "try it and find out." Quote [sIGPIC]e[/sIGPIC]
Leaders snarfblam Posted June 24, 2006 Leaders Posted June 24, 2006 I've tested both methods on the linked-to page. The most important thing to note is that they do not behave the same way. The second will copy the image of a control directly off the screen. This means that it will work for a rich text box. The drawback is that since the image is copied from the screen, if the control is not completely visible (i.e. is hidden, partially or completely covered by another control or window, or out of the bounds of the screen or its container) it will not be drawn as excpected. The first actually gives the control a device context to render to exactly as it would render itself to the screen. This means that a control that supports this function will always draw itself successfully regardless of how it appears on the screen. It also means that you can't use it to draw a RichTextBox because the RichTextBox does not support DrawToBitmap. (It also draws forms as though they are unfocused.) Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.