Get Transparent ( Solved )

Get Transparent ( Solved )

Postby lailton.webmaster » Tue Sep 08, 2009 10:15 pm

How make to GET stay transparent ?

i try oGet:lTRansparent:=.t.

no give me erro more no stay transparent :(
Last edited by lailton.webmaster on Fri Sep 11, 2009 5:12 am, edited 1 time in total.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Transparent

Postby lailton.webmaster » Tue Sep 08, 2009 10:43 pm

sample my problem.

#include "fivewin.ch"

function main()

public odlg, oget, cVar:=space(50)
define dialog odlg REsource "TELA" //color 0,CLR_BLUE

redefine get oGet var cVar ID 4001 of odlg
oGet:lTRansparent:=.t.

oDlg:bPainted:= {|| SETbgGET(oDlg, oGet) }
activate dialog odlg centered

return

function SETbgGET( _oDlg, _oGet )

local aGrad := { { 0.50, 8388608, 16777215 }, { 0.50, 16777215, 8388608 } }
local oControl := _oGet

if "TGET" $ oControl:ClassName()


GradientFill( _oDlg:hDC, oControl:nTop -3,;
oControl:nLeft-3,;
oControl:nTop + oControl:nHeight +3,;
oControl:nLeft+ oControl:nWidth +3, aGrad, .t. )


endif

return Nil
//--------------------------------------------------------------------------------------------------------
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Transparent

Postby Daniel Garcia-Gil » Wed Sep 09, 2009 4:10 am

Hello Lailton

is so easy...
Fivewin have a new function GradientBmp( oControl, nWidth, nHeight, aColors )-->hBmp, is in tribbon class
if you don't have the last version, see below
Code: Select all  Expand view
#include "fivewin.ch"
function main()

 local  odlg, oget, cVar:=space(50),ogetb, cVarb:=space(50)

 define dialog odlg

  @ 5, 10 get oGet  var cVar  of odlg pixel size 120, 10 noborder color CLR_WHITE
  @ 20, 10 get oGetb var cVarb of odlg pixel size 120, 10 noborder color CLR_WHITE

  oGet:lTransparent = .T.
  oGetb:lTransparent = .T.

 activate dialog odlg centered on init( GradGet( Self ) )


return nil

function GradGet( _oDlg )
local oControl
local aColors :=   { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
                     { 0.6, nRGB( 24,  61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush


  for n = 1 to Len(_oDlg:aControls)
     oControl:= _oDlg:aControls[ n ]
     if "TGET" $ oControl:ClassName()
        hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
        oBrush = TBrush():New( , , , , hBmp )
        oControl:SetBrush( oBrush )
        DeleteObject( hBmp )
     endif

  next

return Nil


Image

Code: Select all  Expand view
function GradientBmp( oWnd, nWidth, nHeight, aColors )

   local hDC, hBmp, hBmpOld
   local aRect := GetClientRect( oWnd:hWnd )

   default nHeight := aRect[ 3 ] , nWidth := aRect[ 4 ]

   hDC     = CreateCompatibleDC( oWnd:GetDC() )
   hBmp    = CreateCompatibleBitMap( oWnd:hDC, nWidth, nHeight )
   hBmpOld = SelectObject( hDC, hBmp )
   GradientFill( hDC, 0, 0, nHeight, nWidth, aColors )

   SelectObject( hDC, hBmpOld )
   DeleteDC( hDC )
   DeleteObject( hBmpOld )
   oWnd:ReleaseDC()

return hBmp
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Transparent

Postby ukoenig » Wed Sep 09, 2009 7:48 am

Hello Daniel,

Thanks for the Solution.
I included the Test in the Tools, but it doesn't work 100 %.
The Gradient-display is different inside the Get's.
Only 1, 5, 9 and Line 3, 7, 11 are the same.
In my Test-Dialog, the Get-Class is not detected.
Is it possible, to center the text vertical inside the Get,
something like < oGet:nHeight := ( top-space + fontheight + bottom-space ) > ???
Maybe still something to change ?

Image

I changed the Textcolor to white, to make it better visible.
Image

Code: Select all  Expand view

FUNCTION T_PREVIEW4()
LOCAL oDlg5, oBtn50, oBtn30, oGet, oBMP0
LOCAL oGET1,oGET2,oGET3,oGET4,oGET5,oGET6
LOCAL oGET7,oGET8,oGET9,oGET10,oGET11,oGET12

oProgFont := TFont():New("Arial", ,-16,.F.,.F. , , , ,.F. )

DEFINE DIALOG oDlg5 RESOURCE "TXTTEST3"  TITLE  "Text-Test" ;
FONT oProgFont // TRANSPARENT

REDEFINE BITMAP oBMP0  ID 300  ADJUST  RESOURCE "White"  OF oDlg5
oBMP0:cTooltip := "Please select a Button"

// Windows- Dialog-Title Height = 30
// --------------------------------------------
oBMP0:bPainted := { |hDC| ;
DRAW_TITLE( oDlg5, ;
   oBMP0, ;     // BMP
   hDC, ;           // hDC
   .T., ;           // Horiz. or Vert.
   14853684, ;      // 1. Grad-Color
   16314573, ;      // 2. Grad-Color
   0.50, ;          // Color-Pos.
   30, ;            // Text-Pos from left ( 0 = centered )
   oButtFont, ;     // Font
   128, ;           // Font-Color
   "GET with Gradient on Dialog-Gradient or Color ...") }      

REDEFINE SAY oGET1  VAR cText1 ID 110  OF oDlg5  COLOR  T_COLOR  NOBORDER  FONT oTextFont
oGet1:lTransparent = .T.

// 12 GET's

REDEFINE BTNBMP oBtn30 ID 30 OF oDlg5  2007 ;
FILENAME c_path + "\Images\Preview.bmp" ;
LEFT ;
PROMPT "  &Source  " ;
FONT oProgFont ;
ACTION ( SET_TEXT() )

oBtn30:lTransparent = .t.  
oBtn30:cTooltip :=  { "Show" + CRLF + ;
   "the Source","Source", 1, CLR_BLACK, 14089979 }

REDEFINE BTNBMP oBtn50 ID 50 OF oDlg5  2007 ;
FILENAME c_path + "\Images\exit.bmp" ;
LEFT ;
PROMPT "  &Exit  " ;
FONT oProgFont ;
ACTION ( oDlg5:End() )

oBtn50:lTransparent = .t.  
oBtn50:cTooltip :=  { "Close" + CRLF + ;
   "the Gradient-Test","Close Dialog", 1, CLR_BLACK, 14089979 }

ACTIVATE DIALOG oDlg5 CENTERED ;
ON INIT ( D_GRAD( oDlg5, hDC ), GradGet( Self ) )

return nil

oProgFont:End()

RETURN(  NIL )

// -------------------------------

FUNCTION GradGet( _oDlg )
local oControl
local aColors :=   { { T_MOVE, T_COLOR1, T_COLOR2 },;
   { 1-T_MOVE, T_COLOR2, T_COLOR1 } }
local hBmp, n
local oBrush
for n = 1 to Len(oDlg:aControls)
     oControl:= oDlg:aControls[ n ]
 *    if "TGET" $ oControl:ClassName()   // NOT DETECTED
        hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
        oBrush = TBrush():New( , , , , hBmp )
        oControl:SetBrush( oBrush )
        DeleteObject( hBmp )
*     endif
next

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

Re: Get Transparent

Postby Daniel Garcia-Gil » Wed Sep 09, 2009 11:18 am

Hello Uwe...

this work to me...
next samples is fwh\samples\testd.prg (modify)
Code: Select all  Expand view
// test
#INCLUDE "FIVEWIN.CH"
         
FUNCTION MAIN()
//
//
LOCAL ODLG, ;
      DNOM     := SPACE(40), ;
      DSURNOM  := SPACE(40), ;
      DTEL     := SPACE(10), ;
      DPOSTAL  := SPACE(05), ;
      DREFCDE  := SPACE(40), ;
      LSAVE    := .F. , ;
      DVILLE   := SPACE(30),aFont

//

SetResDebug( .t. )

DEFINE FONT aFONT NAME "Times New Roman" SIZE 0,-14 BOLD
//
DEFINE DIALOG ODLG RESOURCE "DEV02"
//
REDEFINE GET DNOM    ID 201 OF ODLG PICTURE REPLICATE("X",40)
REDEFINE GET DSURNOM ID 202 OF ODLG PICTURE REPLICATE("X",40)
REDEFINE GET DVILLE  ID 203 OF ODLG PICTURE REPLICATE("!",30)
REDEFINE GET DREFCDE ID 204 OF ODLG
REDEFINE GET DTEL    ID 205 OF ODLG PICTURE "@R XX-XX-XX-XX-XX"
REDEFINE GET DPOSTAL ID 206 OF ODLG PICTURE "@Z 99999"
//

REDEFINE BTNBMP RESOURCE "BUTCAN" ID 02 OF ODLG ;
                ACTION(LSAVE := .F., ODLG:END() )
//
REDEFINE BTNBMP RESOURCE "BUTOK" ID 01 OF ODLG ;
      ACTION LSAVE := .T., ODLG:END()

//
ACTIVATE DIALOG ODLG CENTERED on init( GradGet( Self ) )

AFONT:END()

CheckRes()

RETURN NIL

function GradGet( _oDlg )
local oControl
local aColors :=    { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
                     { 0.6, nRGB( 24,  61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush


  for n = 1 to Len(_oDlg:aControls)
     oControl:= _oDlg:aControls[ n ]
     if oControl:ClassName() == "TGET"
        oControl:lTransparent = .T.
        hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
        oBrush = TBrush():New( , , , , hBmp )
        oControl:SetBrush( oBrush )
        DeleteObject( hBmp )
     endif

  next

return Nil
 

Image
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Transparent

Postby lailton.webmaster » Wed Sep 09, 2009 9:53 pm

Image

In fivewin 902 it´s no work. :(

what´s i need do ?
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Transparent

Postby lailton.webmaster » Thu Sep 10, 2009 2:14 am

Itry compile using FWH 907

more give me this error when compile.
Error: Unresolved external 'PrintWindow' referenced from c:\fwh907\lib\fivehc.lib|Ribbon

:(

i want that this work in fwh902 because i have others libs that need xharbour 1.1.0 :)

thanks
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Transparent

Postby lailton.webmaster » Thu Sep 10, 2009 2:20 am

#pragma BEGINDUMP

#include <windows.h>

typedef BOOL ( FAR PASCAL * LPPRINTWINDOW )( HWND hWnd, HDC hDC, UINT nFlags );

BOOL WINAPI PrintWindow( HWND hWnd, HDC hDC, UINT uiFlags )
{
LPPRINTWINDOW pPW;
HINSTANCE hDLL = LoadLibrary( "user32.dll" );
BOOL bResult = FALSE;

if( hDLL )
{
pPW = ( LPPRINTWINDOW ) GetProcAddress( hDLL, "PrintWindow" );
bResult = pPW( hWnd, hDC, uiFlags );
FreeLibrary( hDLL );
}

return bResult;
}

#pragma ENDDUMP


Solved using this.

more yet no work in fwh902

what´s i need make to work in fwh902 ? thanks
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Transparent

Postby lailton.webmaster » Thu Sep 10, 2009 7:38 pm

Someone ? yet need this in fwh902 :(
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Transparent

Postby lailton.webmaster » Fri Sep 11, 2009 2:26 am

Yet no found solucion ....

Someone ?
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Transparent

Postby Daniel Garcia-Gil » Fri Sep 11, 2009 3:26 am

Hello Lailton

from version 9.06 TBrush class was enhanced
* Enhancements: Class TBrush

a. Now any image file ( jpg, png, etc. ) can be used to create a Brush.
b. Brush can also be created from a bitmap handle by specifying the handle as the fifth parameter of TBrush():New() method. Command support for this is not provided.


i don't test it, please try with:
Code: Select all  Expand view
function GradGet( _oDlg )
local oControl
local aColors :=    { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
                     { 0.6, nRGB( 24,  61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush


  for n = 1 to Len(_oDlg:aControls)
     oControl:= _oDlg:aControls[ n ]
     if oControl:ClassName() == "TGET"
        oControl:lTransparent = .T.
        hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
        oBrush = TBrush():New( )  //<==
        oBrush:hBrush = CreatePatternBrush( hBmp )  //<==
        oControl:SetBrush( oBrush )
        DeleteObject( hBmp )
     endif

  next

return Nil
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Transparent

Postby lailton.webmaster » Fri Sep 11, 2009 5:11 am

Now WORK !!!!!!!!!!

Thanks so much :)

:mrgreen:
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm


Return to FiveWin for Harbour/xHarbour

Who is online

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

cron