Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Print form with labels and editors
posted

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 call
invokePaintInfo.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