Any infos about function < C5RoundRect > ? ( solved )

Any infos about function < C5RoundRect > ? ( solved )

Postby ukoenig » Mon Apr 14, 2014 3: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

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

Image

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.

Image

Best regards
Uwe :?:
Last edited by ukoenig on Mon Apr 14, 2014 6:46 pm, edited 2 times in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Any infos about function < C5RoundRect > ?

Postby Antonio Linares » Mon Apr 14, 2014 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Any infos about function < C5RoundRect > ?

Postby ukoenig » Mon Apr 14, 2014 5: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.

Image

17 possible styles :

Image

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Any infos about function < C5RoundRect > ? ( solved )

Postby ukoenig » Wed Apr 16, 2014 9: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.

Image

Image

the circle function

Code: Select all  Expand view  RUN

// -------------- 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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 101 guests