[Mono-winforms-list] Project status of WinForms on MacOS

Stefan Csomor csomor at advancedconcepts.ch
Fri Nov 2 15:34:38 EDT 2007


Hi
> The way this should be tackled is to use the HITheme APIs in HIToolkit
> (thanks Stefan), instead of DrawTheme*.  These should be able to paint
> out of loop for you.  We support out of loop painting already in MWF
> (with a few caveats) so it is indeed possible.  I would suggest starting
> with a simple theme that extends the Win32 one but overrides Button for
> instance and calls HIThemeDrawButton. 
> Take a look through HIToolbox/HITheme.h for more information on HITheme,
> its a public supported API as of 10.4
>   
if you have a CGContextRef for drawing while being in a paint event, 
then this is preferred (especially because of the artefacts occuring if 
you double draw with a transparent background), then you can use the cg 
from the event directly (kEventParamCGContextRef) , but if you cannot - 
being out of the paint event, you will have to setup something like

CGContextRef cgContext;
OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , 
&cgContext);

... do the drawing ...

QDEndCGContext( GetWindowPort( m_windowRef ) , &cgContext);

IMHO another good thing (especially when being in the paint event) is 
always to bracket everything with a

CGContextSaveGState( cgContext);
CGContextRestoreGState( cgContext);

to avoid leaving a mess for the next control that gets drawn ...

Best,

Stefan






More information about the Mono-winforms-list mailing list