gradient with bitmap transparent or text (urgent)
gradient with bitmap transparent or text (urgent)
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
very thanks
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: gradient with bitmap transparent or text (urgent)
Code: Select all | Expand
#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
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: gradient with bitmap transparent or text (urgent)
Code: Select all | Expand
#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
- RAMESHBABU
- Posts: 626
- Joined: Fri Oct 21, 2005 5:54 am
- Location: Secunderabad (T.S), India
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.
Regards to you
- Ramesh Babu P
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
#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
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42521
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 76 times
- Contact:
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.
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.
-
- Posts: 465
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- Contact:
-
- Posts: 465
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- Contact:
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
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