Fixed Brush

Post Reply
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Fixed Brush

Post by ctoas »

Friends.

I need to make a solid color brush that has a fixed size in the footer no matter the size of the window, is this possible?

Thanks
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Fixed Brush

Post by nageswaragunupudi »

Code: Select all

#include "fivewin.ch"

function Main()

   local oWnd
   local nBrushHt    := 80
   local nBrushClr   := CLR_HGRAY

   DEFINE WINDOW oWnd TITLE "FOOTER BRUSH"

   oWnd:bPainted := <|hDC|
      local aRect    := GetClientRect( oWnd:hWnd )
      local hBrush   := CreateSolidBrush( nBrushClr )

      aRect[ 1 ] := aRect[ 3 ] - nBrushHt
      FillRect( hDC, aRect, hBrush )
      DeleteObject( hBrush )

      return nil
      >

   ACTIVATE WINDOW oWnd

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Fixed Brush

Post by ctoas »

Thanks for answering.

It worked perfectly, but there was a flaw in translating my message that made window instead of dialog.

Tried to do in a dialog, but generate several errors.

If you can help, I appreciate it.
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Fixed Brush

Post by nageswaragunupudi »

Are you using a very very old version of FWH?
Regards

G. N. Rao.
Hyderabad, India
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Fixed Brush

Post by ctoas »

Resolved with tPanel

Thank you for your help
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Fixed Brush

Post by nageswaragunupudi »

ctoas wrote:Resolved with tPanel

Thank you for your help
No need for workarounds and make the code complex.
We can do it directly with Dialog.

Code: Select all

   local oDlg, aRect, oFooterBrush, nBrushHt := 80

   DEFINE BRUSH oFooterBrush COLOR CLR_HGREEN
   DEFINE DIALOG oDlg SIZE 500,400 PIXEL
   ACTIVATE DIALOG oDlg CENTERED ON PAINT ;
      (  aRect := GetClientRect( oDlg:hWnd ), ;
         aRect[ 1 ] := aRect[ 3 ] - nBrushHt, ;
         FillRect( hDC, aRect, oFooterBrush:hBrush ) ;
      )
   RELEASE BRUSH oFooterBrush
 
When you put a question, we request you to indicate the version of FWH you are using. That makes it easy for us to suggest a solution that works with your version. If not we suggest what works with the latest versions.
Regards

G. N. Rao.
Hyderabad, India
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Fixed Brush

Post by ctoas »

Hello, I hope you had a great Christmas!

Sorry, I know the version rule, but when I saw your message I had already found the tPanel class, but I didn't get to test it for what I wanted.

What I want to do would be custom warning, error and etc messages like this in the image, in this case I tested the know example but where the brush does not accept anything over transparent.

Image
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Fixed Brush

Post by ukoenig »

You can use TTitle
What I want to do would be custom warning, error and etc messages
like this in the image,
in this case I tested the know example but where the brush
does not accept anything over transparent.
use windows or dialog
transparent- or brushed title
brushed 3D-text
defined border with pensize and transparent-level
or NO border

I added another test to sample < Testtitle.prg >

Image

Code: Select all

...
...
    @ 250, 150 TITLE oTitle3 size 460, 60 of oWnd TRANSPARENT NOBORDER 
    @   8,  100 TITLETEXT OF oTitle3 TEXT FWVERSION FONT oFont1 brush oBrush4 3D SHADOW TOPRIGHT
    @   2,  30 TITLEIMG OF oTitle3 BITMAP "..\bitmaps\32X32\keys.bmp" SIZE 50, 50 REFLEX TRANSPARENT ;
    ACTION MsgInfo( "Keys" )

oWnd:bPainted := < |hDC|
    DRAWBORDER( oWnd, oTitle3 )
RETURN NIL
>
...
...
// -----------

FUNCTION DRAWBORDER( oWnd, oTitle3 )
LOCAL oGraphics := Graphics():New( oWnd:hDC ) 
LOCAL nRed      := nRGBRed( 255 ) // red
LOCAL nGreen    := nRGBGreen( 255 )
LOCAL nBlue     := nRGBBlue( 255 )
LOCAL oPen      := Pen():New( 255, nRed, nGreen, nBlue, 5, .T.) // nTransparency, nRed, nGreen, nBlue

oGraphics:DrawRoundRect( oPen, , oTitle3:nLeft, oTitle3:nTop, oTitle3:nWidth, oTitle3:nHeight, 30 ) 

oGraphics:Destroy()
oPen:Destroy()

RETURN NIL
 
Last edited by ukoenig on Fri Dec 27, 2019 11:35 am, edited 3 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
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Fixed Brush

Post by nageswaragunupudi »

Is this what you want?
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Fixed Brush

Post by nageswaragunupudi »

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg, oFont, oSay, oBtn
   local cMsg  := "Message"
   local aColor   := { 0x91ffff, 0x4bb7fe }

   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-30
   DEFINE DIALOG oDlg SIZE 500,200 PIXEL TRUEPIXEL COLOR CLR_WHITE, 1 STYLE WS_POPUP
   oDlg:nSeeThroClr  := 1

   @ 00,120 SAY oSay PROMPT cMsg SIZE 350,100 PIXEL OF oDlg CENTER VCENTER ;
      FONT oFont COLOR CLR_HRED, aColor[ 1 ]

   @ 140,350 BTNBMP oBtn BITMAP "c:\fwh\bitmaps\32x32\yes.bmp" SIZE 40,40 PIXEL ;
      OF oDlg FLAT NOBORDER ACTION oDlg:End()
   oBtn:bClrGrad  := { || { { 1, aColor[ 2 ], aColor[ 2 ] } } }

   ACTIVATE DIALOG oDlg CENTERED ON PAINT DlgPaint( hDC, oDlg, aColor )
   RELEASE FONT oFont

return nil

static function DlgPaint( hDC, oDlg, aColor )

   local hWnd     := oDlg:hWnd
   local aRect    := GetClientRect( hWnd )
   local nTop     := aRect[ 1 ]
   local nBottom  := aRect[ 3 ]
   local nHt      := 80
   local hRgn     := CreateRoundRectRgn( aRect, 80, 80 )

   local hBrush

   SelectClipRgn( hDC, hRgn )
   hBrush         := CreateSolidBrush( aColor[ 1 ] )
   aRect[ 3 ]     := nBottom - nHt
   FillRect( hDC, aRect, hBrush )
   DeleteObject( hBrush )

   hBrush         := CreateSolidBrush( aColor[ 2 ] )
   aRect[ 1 ]     := aRect[ 3 ]
   aRect[ 3 ]     := nBottom

   FillRect( hDC, aRect, hBrush )
   DeleteObject( hBrush )
   SelectClipRgn( hDC )
   DeleteObject( hRgn )

   FW_DrawImage( hDC, "c:\fwh\bitmaps\alphabmp\ichat.bmp", { 90,50,154,114 } )

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
ctoas
Posts: 103
Joined: Wed Oct 26, 2005 2:38 pm
Location: São Paulo - Brasil
Contact:

Re: Fixed Brush

Post by ctoas »

nageswaragunupudi wrote:Is this what you want?
Image
Perfect, that's what I was looking for.

Thanks!

Image
Christiano Augusto Silveira
christiano.silveira@gmail.com

MaxxTech Soluções em TI
http://www.maxxtech.com.br
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: Fixed Brush

Post by ukoenig »

Added brushed text with 3D look,
gradient base,
and border with possible transparent-level,
possible to move the dialog,
mixing my sample from above with Mr. Rao's solution

Image

regards
Uwe :D
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.
Post Reply