[Lazarus] Drawing on MAC using GetDC
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Sep 7 11:07:48 CEST 2012
Torsten Bonde Christiansen <tc at epidata.info> hat am 7. September 2012 um 11:00
geschrieben:
> Hi List
>
> I am currently trying to improve on the ported version of jvRuntimeDesigner
> component (available at SF here
> <http://sourceforge.net/projects/jvruntimedesign/> ),
> but I am having a hard time getting it working correctly on a MAC with the
> Carbon widgetset.
>
> More specifically the component uses a GetDC(..) (GetDesignerDC(..) on
> linux/windows) to retrieve a device
> context to draw to, using regular canvas. But where on GTK2 (linux) and
> Windows the drawing goes well and
> is fully visible, nothing happens on MAC.
>
> My research have lead me so far, that I think the problem is that component
> has not system DC, but instead
> is assigned an empty DC.
>
> I have practically no experience in programming directly to MAC and I have no
> clue what to look for, so any
> help would be appriciated.
>
You can paint *only* during the OnPaint event on Mac.
For the designer paint in the Paint event of the form:
DesignerDC := GetDesignerDC(Form.Handle);
...draw...
ReleaseDesignerDC(Form.Handle, DesignerDC);
Mattias
More information about the Lazarus
mailing list