I want to print the controls on a form. For that I have a panel on my form that have all necessary controls in the container. For this panel and for the controls in the controls collection I call recursive a print method in that I print the control to a bitmap.
-- definition static MethodInfo invokePaintInfo = typeof(Control).GetMethod("InvokePaint", BindingFlags.Instance | BindingFlags.NonPublic);
-- th callinvokePaintInfo.Invoke(control, paintArgs); It works and it paints the control to the bitmap and I can print the bitmap. On Windows 7 I have the problem that with ‘Performance Options: Smooth edges of screen fonts’ the printed fonts are very bad. I found out that when I change UseOsThemes from Default to False
ctrl..UseOsThemes = DefaultableBoolean.False;
it works better. But now I have the problem that the border is not printed on the TextEditor Controls. For UltraLabel it’s works.
Is their a better way to solve the problem?
Thanks
Hello ,
UseOsThemes indicates whether the elements of a control may be rendered using the operating system theme rendering. Maybe better approach is to draw what is already drawn on the screen to a bitmap. GDI has the BitBlt function which allows C# developers to do that efficiently. The BitBlt function is located in the GDI32.dll.
I have created a small sample in order to demonstrate this approach. Please run the sample and press “Capture TextBox” in order to get bitmap of UltraTextEditor and to display it in the PictureBox.
Please let me know if you have any further questions.
Sorry I have not seen your email with the sample (too much emails in my inbox).
I will look on it and give you a response I hope tomorrow or on monday.
Joachim