TBAR CON BRUSH DE FONDO

Post Reply
claudio.leiva
Posts: 18
Joined: Thu Aug 17, 2023 8:37 pm

TBAR CON BRUSH DE FONDO

Post by claudio.leiva »

buenas estimados
tengo la siguiente duda
digamos que tengo una barra con botones clase tbar
se puede hacer que en dicha barra tenga un brush de fondo que se ajuste al tamaño de la barra un bmp o jpg o png
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: TBAR CON BRUSH DE FONDO

Post by karinha »

Algo asi?

Code: Select all | Expand

// \SAMPLES\BARBRUSH.PRG

#include "Fivewin.ch"

STATIC oWnd

FUNCTION Main()

   LOCAL oBar, oBtn1, oBrush

   DEFINE BRUSH oBrush COLOR CLR_HBLUE

   DEFINE WINDOW oWnd TITLE "Testebar" FROM 118, 266 TO 561, 801 PIXEL       ;
      COLOR 0, 14215660

   DEFINE BUTTONBAR oBar OF oWnd _3D Size 030, 030

   DEFINE BUTTON oBtn1 OF oBar

   oBar:SetBrush( oBrush )

   ACTIVATE WINDOW oWnd

RETURN NIL
 
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
claudio.leiva
Posts: 18
Joined: Thu Aug 17, 2023 8:37 pm

Re: TBAR CON BRUSH DE FONDO

Post by claudio.leiva »

oi karinha
boa tarde
tudo bem

// \SAMPLES\BARBRUSH.PRG

#include "Fivewin.ch"

STATIC oWnd

FUNCTION Main()

LOCAL oBar, oBtn1, oBrush

DEFINE BRUSH oBrush COLOR CLR_HBLUE <---- ACA CON FILE "IMAGEN.JPG"
DEFINE BRUSH oBrush FILE "IMAGEN.JPG"

DEFINE WINDOW oWnd TITLE "Testebar" FROM 118, 266 TO 561, 801 PIXEL ;
COLOR 0, 14215660

DEFINE BUTTONBAR oBar OF oWnd _3D Size 030, 030

DEFINE BUTTON oBtn1 OF oBar

oBar:SetBrush( oBrush )

ACTIVATE WINDOW oWnd

RETURN NIL

lo que pasa y necesito es el el jpg se ajuste a toda la tbar
se podra?
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: TBAR CON BRUSH DE FONDO

Post by karinha »

Code: Select all | Expand

// \SAMPLES\BARBRUSH.PRG

#include "Fivewin.ch"

STATIC oWnd

FUNCTION Main()

   LOCAL oBar, oBtn1, oBrush

   // DEFINE BRUSH oBrush COLOR CLR_HBLUE

   // Desde Recursos:
   // DEFINE BRUSH oBrush RESOURCE "WPaper" STRETCH // O RESIZE

   DEFINE BRUSH oBrush FILE "..\bitmaps\BRUSH4.bmp" STRETCH // O RESIZE

   DEFINE WINDOW oWnd TITLE "Testebar" FROM 118, 266 TO 561, 801 PIXEL       ;
      COLOR 0, 14215660

   DEFINE BUTTONBAR oBar OF oWnd _3D Size 030, 030

   DEFINE BUTTON oBtn1 OF oBar

   oBar:SetBrush( oBrush )

   ACTIVATE WINDOW oWnd

RETURN NIL

// FIN / END
 
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: TBAR CON BRUSH DE FONDO

Post by karinha »

Otro modelo:

Code: Select all | Expand

// \SAMPLES\BARBRUSH.PRG

#include "Fivewin.ch"

STATIC oWnd

FUNCTION Main()

   LOCAL oBar, oBtn1, oBrush, oBmp

   // DEFINE BRUSH oBrush COLOR CLR_HBLUE

   // Desde Recursos:
   // DEFINE BRUSH oBrush RESOURCE "WPaper" STRETCH // O RESIZE

   DEFINE BRUSH oBrush FILE "..\bitmaps\BRUSH4.bmp" STRETCH // O RESIZE

   // DEFINE WINDOW oWnd TITLE "Testebar" FROM 118, 266 TO 561, 801 PIXEL       ;
   //   COLOR 0, 14215660

   DEFINE WINDOW oWnd MDI STYLE nOr( WS_POPUP )

   oWnd:SetColor( CLR_WHITE, Rgb( 44, 44, 44 ) )

   DEFINE BUTTONBAR oBar OF oWnd _3D Size 030, 030 NOBORDER

   WITH OBJECT oBar

      oBar:nClrText := CLR_BLACK

      // oBar:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )
      oBar:SetBrush( oBrush )

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      // oBar:SetFont( oFont )

      oBar:Adjust()

   END

   DEFINE BUTTON oBtn1 OF oBar PROMPT "Exit" ACTION( oWnd:End() )

   oBtn1:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BITMAP oBmp FILENAME "..\bitmaps\BACK.bmp"  // WOW()!!

   oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }

   ACTIVATE WINDOW oWnd MAXIMIZED

RETURN NIL

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   local nRow := 0, nCol := 0, n
   local nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   if oBmp:hBitmap == 0
      return nil
   endif

   while nRow < nHeight
      nCol = 0
      while nCol < nWidth
         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
         nCol += nBmpWidth
      end
      nRow += nBmpHeight
   end

RETURN NIL

// FIN / END
 
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
claudio.leiva
Posts: 18
Joined: Thu Aug 17, 2023 8:37 pm

Re: TBAR CON BRUSH DE FONDO

Post by claudio.leiva »

karinha

el brush se repite y repite,,, como se puede ajustar al ancho de la barra

como pongo una imagen aca?
para que veas
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: TBAR CON BRUSH DE FONDO

Post by karinha »

claudio.leiva wrote:karinha

el brush se repite y repite,,, como se puede ajustar al ancho de la barra

como pongo una imagen aca?
para que veas
No recuerdo, con Image? SetImage()? SetBitMap()?

Lo siento.

Reagrds, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
claudio.leiva
Posts: 18
Joined: Thu Aug 17, 2023 8:37 pm

Re: TBAR CON BRUSH DE FONDO

Post by claudio.leiva »

poner una imagen aca en el foro
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: TBAR CON BRUSH DE FONDO

Post by karinha »

claudio.leiva wrote:poner una imagen aca en el foro
https://imgur.com/jVBTWdo

Image

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
claudio.leiva
Posts: 18
Joined: Thu Aug 17, 2023 8:37 pm

Re: TBAR CON BRUSH DE FONDO

Post by claudio.leiva »

https://imgur.com/j3HWcnA

a esto me refiero que a imagen del brush se repite,,, no se ajusta al ancho de la tbar
claudio.leiva
Posts: 18
Joined: Thu Aug 17, 2023 8:37 pm

Re: TBAR CON BRUSH DE FONDO

Post by claudio.leiva »

Image
User avatar
karinha
Posts: 7885
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: TBAR CON BRUSH DE FONDO

Post by karinha »

Haga asi:

Code: Select all | Expand

   @ 003, 650 BTNBMP oBtn2 OF oBar SIZE 50, 30 PIXEL FLAT ADJUST     ;
      GDIPLUS BITMAP "..\bitmaps\EXCEL.bmp" LEFT NOROUND WHEN( .F. )
 
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Post Reply