[Mono-winforms-list] Project status of WinForms on MacOS
gnorton at novell.com
Wed Nov 7 15:25:27 EST 2007
On Wed, 2007-11-07 at 13:25 -0600, Brock Reeve wrote:
> Ok. I have looked into this some more and am getting the button to
> draw somewhat. The middle part isn't drawing correctly. I got this to
> work running a simple test program in C and compiled on the Mac.
> The graphics object doesn't give access to the raw quartz handle
> (CGContext) which is created in Graphics.FromHwnd and set on
> GDIPlus.Display static variable. The only way I could get it was to
> copy the code from Carbon.GetCGContextForView and use that in my
> drawing code for my button. I think this might be screwing it up
> somehow because I am creating another CGContext when one was already
> created for the Graphics object. Maybe we could support
> IServiceProvider or something on the Graphics object so we could query
> for the CGContext. There is another issue where if you click on the
> button it fails to draw again. Here is the code for the button and a
> screen shot. I am just experiementing for now putting the code in the
> button OnPaint rather than the Theme stuff.
Be aware that code there is going to be updated to use QDBeginCGContext
at some point. It also had the flaw of not CFRelease-ing the used
context. Lastly its been refactored today; because using that static
wasn't thread safe so we now store the CGContextRef in a internal
variable to the Graphics context. This leaves you with two choices:
#2: Generate your own (these can be cached in fact; we dont do it on the
Graphics side right now, but we could and QDBeginCGContext takes care of
this for you)
As for something like IServiceProvider, this wont happen as we cannot
change the public API for System.Drawing.
As for the click issue; its probably where you're hooking the drawing,
but I'd have to look more closely at Button(Base) to tell you.
More information about the Mono-winforms-list