gradient with bitmap transparent or text (urgent)

gradient with bitmap transparent or text (urgent)

Postby Nop » Fri Jun 22, 2007 3:19 pm

HI, i need an sample to put an gradient (degrade) gray in main window (mdi) and an transparente bitmap or with an text raised, someone has an sample??
very thanks
User avatar
Nop
 
Posts: 107
Joined: Tue Apr 11, 2006 4:36 pm
Location: Uberaba/Brazil

Postby Nop » Fri Jun 22, 2007 8:31 pm

i need only an degrade in main windows...
User avatar
Nop
 
Posts: 107
Joined: Tue Apr 11, 2006 4:36 pm
Location: Uberaba/Brazil

Re: gradient with bitmap transparent or text (urgent)

Postby Enrico Maria Giordano » Sat Jun 23, 2007 9:41 am

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd

    DEFINE WINDOW oWnd MDI

    ACTIVATE WINDOW oWnd;
             ON PAINT GRADIENT( oWnd, hDC )

    RETURN NIL


STATIC FUNCTION GRADIENT( oWnd, hDC )

    LOCAL aRect := GETCLIENTRECT( oWnd:hWnd )
    LOCAL nStep := ( aRect[ 3 ] - aRect[ 1 ] ) / 256

    LOCAL oBrush

    LOCAL i

    aRect[ 3 ] = nStep

    FOR i = 255 TO 0 STEP -1
       DEFINE BRUSH oBrush;
              COLOR RGB( i, i, i )

       FILLRECT( hDC, aRect, oBrush:hBrush )

       RELEASE BRUSH oBrush

       aRect[ 1 ] += nStep
       aRect[ 3 ] += nStep
    NEXT

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: gradient with bitmap transparent or text (urgent)

Postby Enrico Maria Giordano » Sat Jun 23, 2007 11:34 am

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, hBmp, oFnt

    DEFINE WINDOW oWnd MDI

    hBmp = READBITMAP( 0, "\FWH\BITMAPS\INSTALL.BMP" )

    DEFINE FONT oFnt NAME "Arial" SIZE 0, -20

    ACTIVATE WINDOW oWnd;
             ON PAINT ( GRADIENT( oWnd, hDC ),;
                        IF( hBmp != 0, DRAWMASKED( hDC, hBmp, 200, 200 ), ),;
                        oWnd:oWndClient:Say( 20, 10, "This is a test", CLR_HRED, , oFnt, , .T. ) )

    IF hBmp != 0; DELETEOBJECT( hBmp ); ENDIF

    RELEASE FONT oFnt

    RETURN NIL


STATIC FUNCTION GRADIENT( oWnd, hDC )

    LOCAL aRect := GETCLIENTRECT( oWnd:hWnd )
    LOCAL nStep := ( aRect[ 3 ] - aRect[ 1 ] ) / 256

    LOCAL oBrush

    LOCAL i

    aRect[ 3 ] = nStep

    FOR i = 255 TO 0 STEP -1
       DEFINE BRUSH oBrush;
              COLOR RGB( i, i, i )

       FILLRECT( hDC, aRect, oBrush:hBrush )

       RELEASE BRUSH oBrush

       aRect[ 1 ] += nStep
       aRect[ 3 ] += nStep
    NEXT

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Nop » Sat Jun 23, 2007 1:25 pm

works fine, very thanks Enrico.
User avatar
Nop
 
Posts: 107
Joined: Tue Apr 11, 2006 4:36 pm
Location: Uberaba/Brazil

Postby RAMESHBABU » Mon Jun 25, 2007 5:41 pm

Hi Enrico

Some more stress on you :(

It was an long pending un-resolved problem :?

On the Gradient Dialogs, the Checkboxes or Radiobuttons are not painted
transparent in both themed and non-themed.

Can you please find out a solution for this.

I am enclosing the modified program here for your solution.


Code: Select all  Expand view
#include "Fivewin.ch"

FUNCTION MAIN()

    LOCAL oDlg, hBmp, oFnt, oRadio, oCheck, nValue := 1, lCheck := .F., oCheck1, lCheck1 := .F., oGet, cGet := SPACE(50)

    DEFINE DIALOG oDlg SIZE 250, 250 TRANSPARENT

    hBmp = READBITMAP( 0, "\FWH\BITMAPS\INSTALL.BMP" )
    DEFINE FONT oFnt NAME "Arial" SIZE 0, -20

    @ 1.75,0 RADIO oRadio VAR nValue ITEMS "Radio&1 not OK", "&Rado&2 not OK" OF oDlg SIZE 60, 12

    @ 1.65,09 CHECKBOX oCheck  VAR lCheck  PROMPT "CheckBox&1 not OK"  OF oDlg SIZE 80,12
    @ 2.50,09 CHECKBOX oCheck1 VAR lCheck1 PROMPT "CheckBox&2 not OK"  OF oDlg SIZE 80,12

    ACTIVATE DIALOG oDlg CENTERED ;
             ON PAINT ( GRADIENT( oDlg, hDC ),;
                        IF( hBmp != 0, DRAWMASKED( hDC, hBmp, 65, 65 ), ),;  //,;
                        oDlg:Say( 1, 1, "This Say is OK", CLR_HRED, , oFnt, , .T. ), SysRefresh() )

    IF hBmp != 0; DELETEOBJECT( hBmp ); ENDIF

    RELEASE FONT oFnt

    RETURN NIL


STATIC FUNCTION GRADIENT( oDlg, hDC )

    LOCAL aRect := GETCLIENTRECT( oDlg:hWnd )
    LOCAL nStep := ( aRect[ 3 ] - aRect[ 1 ] ) / 256

    LOCAL oBrush

    LOCAL i

    aRect[ 3 ] = nStep

    FOR i = 255 TO 0 STEP -1
       DEFINE BRUSH oBrush;
              COLOR RGB( i, i, i )

       FILLRECT( hDC, aRect, oBrush:hBrush )

       RELEASE BRUSH oBrush

       aRect[ 1 ] += nStep
       aRect[ 3 ] += nStep
    NEXT

    RETURN NIL


Regards to you

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Enrico Maria Giordano » Mon Jun 25, 2007 6:30 pm

Sorry, you have to ask Antonio for this.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Jun 25, 2007 7:56 pm

Ramesh,

Its not easy to implement it. The controls paint themselves, but when using themes we use a themes API function to copy the parent background image, so they look fine.

The problem is that such API function does not work with the gradient, as it is not a themed gradient.

Probably there may be a solution, but we have not found it yet.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby ShumingWang » Wed Jun 27, 2007 1:22 am

Fernando Sanchez,
noway button support paint disabled button as the dialog background color?
for example:
redefine viaopenbutton obtton id 101 of dialog when .f.

this hide the obutton .

Regards
Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Postby ShumingWang » Fri Jun 29, 2007 2:10 am

adlgclr:={255,255,255}

bTColor := { |oBtn| If( ! oBtn:lActive, CLR_HGRAY, ;
If( oBtn:lMouseOver, CLR_HBLUE, ;
If( oBtn:lPressed, CLR_HGREEN, CLR_BLACK ) ) ) }

bBColor := { |oBtn| If( oBtn:lActive, rgb(adlgclr[1],adlgclr[2],adlgclr[3]), CLR_WHITE) }



REDEFINE SBUTTON ;
ID 101 ;
PROMPT "basic set" ;
OF oxerpdlg1 ;
RESOURCE "plan08" ;
COLORS bTColor,bBColor ;
TEXT ON_BOTTOM ;
NOBOX ;
ACTION plan11();
WHEN ASCAN(afunctions,"plan11")>0

now tsbutton when .f., it paint color gray ,not as the dialog background color, I want the dialog background color to 'hide' the defined tsbutton include text and bitmap.


Shuming Wang
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China


Return to FiveWin for Harbour/xHarbour

Who is online

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