FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Any infos about function < C5RoundRect > ? ( solved )
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Any infos about function < C5RoundRect > ? ( solved )
Posted: Mon Apr 14, 2014 03:49 PM
Hello,

I tested the function C5RoundRect
but couldn't find anything about possible alterations to change the backgroundcolor or maybe to make it transparent inside. The circle itself, is the selected pencolor and size.
Where does this function come from ?

A test, merged to a image



A sample of usage
( merging different objects : alphablended bmp and free text )
It is possible to change the form from circle to rounded box or ellipse



another combination
a inserted, created signature, a selected image with a added box ( defined pensize and color ).
the pensize and color can be changed at runtime.



Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Any infos about function < C5RoundRect > ?
Posted: Mon Apr 14, 2014 04:51 PM

Uwe,

That function is just a wrapper for the Windows API function RoundRect()

In order to use a brush with it, you should first create the brush and select it to the current hDC and later on, save the current brush using hOldBrush := SelectObject( hDC, oBrush:hBrush ), paint, select the previous brush with SelectObject( hDC, hOldBrush ) and finally destroy the brush ( oBrush:End() )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Any infos about function < C5RoundRect > ?
Posted: Mon Apr 14, 2014 05:50 PM
Antonio,

THANK YOU VERY MUCH !
it works fine that way.
Now I understand the logic.

it can be a brush-combination :

DEFINE BRUSH oBrush1 STYLE NULL
DEFINE BRUSH oBrush2 COLOR 255

with some calculations, it will be possible, to get some nice effects.

I will add four possible forms :

1. round filled ( mouseclick Top / Left for position and a defined size )
2. free form filled ( mouseclick Top / Left and Bottom / Right )
3. round transparent
4. free form transparent

the sample shows a inserted alphablended image
The three textlines are converted from a multiline get.



17 possible styles :



Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Any infos about function < C5RoundRect > ? ( solved )
Posted: Wed Apr 16, 2014 09:51 AM
Antonio,

all four forms are working perfect now.
Circles are a ONE-click solution on image Top / Left
Ellipses are a TWO-click solution on image Top / Left and Bottom / Right
A circle works like a image. The basic-diameter can be define inside the extra-dialog.
Inside the Main-painting area, You can select a resize-factor of the defined size and any pensize and color.





the circle function

Code (fw): Select all Collapse
// -------------- CIRCLE -----

STATIC FUNCTION CL_ROUND( hMemDC, nStyle )
LOCAL hOldBrush, oBrush
LOCAL hOldPen := SELECTOBJECT( hMemDC, hPen )

IF nStyle = 1 // transparent
     DEFINE BRUSH oBrush STYLE NULL 
ELSE
     DEFINE BRUSH oBrush COLOR nPenColor
ENDIF
hOldBrush := SelectObject( hMemDC, oBrush:hBrush )

IF nWFactor > 1 .and. nHFactor > 1 // image < painting area
     MOVETO( hMemDC, aPoints[ 1, 2 ], aPoints[ 1, 1 ] )
     ROUNDRECT( hMemDC, aPoints[ 1, 2 ], ;   // Left
          aPoints[ 1, 1 ], ;    //  Top
          aPoints[ 1, 2 ] + ( nCircle * ( nLIResize / 100 ) ), ;   // Right
          aPoints[ 1, 1 ] + ( nCircle * ( nLIResize / 100 ) ), ;  // Bottom     
          nCircle * ( nLIResize / 100 ), ;  // Width
          nCircle * ( nLIResize / 100 ) )    // Height
ELSE // image > painting area
      IF nWFactor < nHFactor   .OR.   nWFactor < 1 .and. nHFactor > 1 
          MOVETO( hMemDC, aPoints[ 1, 2 ] / nWFactor, aPoints[ 1, 1 ] / nWFactor )
          ROUNDRECT( hMemDC, aPoints[ 1, 2 ] / nWFactor, ;   // Left
              aPoints[ 1, 1 ] / nWFactor, ; //  Top
              ( aPoints[ 1, 2 ] / nWFactor ) + ;
              ( ( nCircle / nWFactor ) * ( nLIResize / 100 ) ), ;   // Right
              ( aPoints[ 1, 1 ] / nWFactor ) + ;
              ( ( nCircle / nWFactor ) * ( nLIResize / 100 ) ), ;  // Bottom        
              nCircle / nWFactor * ( nLIResize / 100 ), ;  // Width
              nCircle / nWFactor * ( nLIResize / 100 ) )    // Height
      ENDIF
      IF nWFactor > nHFactor   .OR.   nWFactor > 1 .and. nHFactor < 1 
             MOVETO( hMemDC, aPoints[ 1, 2 ] / nHFactor, aPoints[ 1, 1 ]  / nHFactor )
             ROUNDRECT( hMemDC, aPoints[ 1, 2 ] / nHFactor, ;   // Left
             aPoints[ 1, 1 ] / nHFactor, ;  //  Top
             ( aPoints[ 1, 2 ] / nHFactor ) + ;
             ( ( nCircle / nHFactor ) * ( nLIResize / 100 ) ), ;   // Right
             ( aPoints[ 1, 1 ] / nHFactor ) + ;
             ( ( nCircle / nHFactor ) * ( nLIResize / 100 ) ), ;  // Bottom     
             nCircle / nHFactor * ( nLIResize / 100 ), ;  // Width
             nCircle / nHFactor * ( nLIResize / 100 ) )    // Height
      ENDIF
ENDIF

DeleteObject( hOldPen )
DeleteObject( oBrush )
DeleteObject( hOldBrush )

// C5RoundRect( hMemDC, 80, 80, 400, 400, 250, 250 )
// That function is just a wrapper for the Windows API function RoundRect()
// In order to use a brush with it, 
// you should first create the brush
// and select it to the current hDC and later on, 
// save the current brush using 
// hOldBrush := SelectObject( hDC, oBrush:hBrush ), 
// paint, 
// select the previous brush with SelectObject( hDC, hOldBrush ) 
// and finally destroy the brush ( oBrush:End() )

RETURN NIL


Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion