Page 1 of 1

twindow:circle()

Posted: Fri Mar 17, 2006 2:33 pm
by reinaldocrespo
Hi (again...)

Using the circle method of twindow I'm able to draw a circle around an bitmap ok. But, I'd like to make that circle transparent ...ie not erase the image inside de circle. Can it be done?

And, can I use a different pen to draw the circle?

Thank you,


Reinaldo.

Re: twindow:circle()

Posted: Fri Mar 17, 2006 3:37 pm
by Enrico Maria Giordano
This is a working sample:

Code: Select all

#include "Fivewin.ch"


#define BRUSH_NULL 5


FUNCTION MAIN()

    LOCAL oWnd

    DEFINE WINDOW oWnd

    ACTIVATE WINDOW oWnd;
             ON PAINT ( oWnd:Say( 3, 0, "This is a test", CLR_GREEN ),;
                        DRAWCIRCLE( oWnd, hDC, 10, 10, 100, CLR_HRED ) )

    RETURN NIL


STATIC FUNCTION DRAWCIRCLE( oWnd, hDC, nTop, nLeft, nWidth, nColor )

    LOCAL hPen := CREATEPEN( PS_SOLID, 1, nColor )

    LOCAL hOldPen   := SELECTOBJECT( hDC, hPen )
    LOCAL hOldBrush := SELECTOBJECT( hDC, GETSTOCKOBJECT( BRUSH_NULL ) )

    oWnd:Circle( nTop, nLeft, nWidth )

    SELECTOBJECT( hDC, hOldPen )
    SELECTOBJECT( hDC, hOldBrush )

    DELETEOBJECT( hPen )

    RETURN NIL
EMG

Posted: Sat Mar 18, 2006 12:09 am
by reinaldocrespo
Enrico;

It works. Fantastic!

If you don't mind, let me ask you; I notice that you are making a reference to hDc, --never declared anywhere?
DRAWCIRCLE( oWnd, hDC,...

Posted: Sat Mar 18, 2006 11:08 am
by Enrico Maria Giordano
It is implicitly passed by the codeblock bPainted.

EMG