How to do transparent it?

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

How to do transparent it?

Post by dutch »

I would like to do transparent Dialog with Bitmap but it still show the Dialog behind the BitMap as following image.

Image

And this is my code. What I do wrong?

Code: Select all

    DEFINE FONT oFnt0 NAME "Tahoma" SIZE 0, -16 BOLD
    DEFINE FONT oFnt1 NAME "Tahoma" SIZE 0, -12 BOLD
    DEFINE FONT oFnt2 NAME "Tahoma" SIZE 0, -18 BOLD
    DEFINE FONT oFnt3 NAME "Umbra-Normal" SIZE 0, -40 BOLD
    DEFINE FONT oFnt4 NAME "Tahoma" SIZE 0, -18 BOLD
    DEFINE FONT oFnt5 NAME "Tahoma" SIZE 0, -12 

    DEFINE BRUSH oBrush STYLE NULL  // FILENAME 'HOME.BMP'

    DEFINE DIALOG oDlg; 
	   BRUSH oBrush ; // TRANSPARENT ;  //     // 	   	   
	   STYLE WS_POPUP ; // nOr( DS_MODALFRAME, WS_POPUP, WS_DLGFRAME, WS_SYSMENU, 4 ) ;
           FONT oFnt0 ;
           TITLE "Please Login" pixel from 0, 0 to 412, 465  // 379, 450

	  @  0,  0 BITMAP oBmp FILE 'BMP\LOGIN3.BMP' OF oDlg TRANSPARENT            
           
     @ 18,70 SAY oSay[3] PROMPT 'EASYFO' COLOR CLR_WHITE SIZE 100, 30 FONT oFnt3 PIXEL 
             oSay[3]:lTransparent := .T.

     @ 45,70 SAY oSay[3] PROMPT 'Hotel Management System' COLOR CLR_HRED SIZE 130, 20 FONT oFnt4 PIXEL 
             oSay[3]:lTransparent := .T.

     @ 80,45 SAY oSay[1] PROMPT "Login Name" COLOR CLR_WHITE SIZE 120,14 PIXEL 
             oSay[1]:lTransparent := .T.

     @ 93,45 GET oGet[1] VAR cLogin PICTURE '@!' COLOR CLR_BLACK, CLR_WHITE SIZE 140, 14 PIXEL ;
     			 VALID ((!empty(cLogin).and.if(lChk := ChkUser(@cLogin,@cLang), ( oCbx:Refresh(), .T. ), (oGet[1]:Refresh(),.F.) )).or.oBtn:lMouseOver)

     @ 108,45 SAY oSay[2] PROMPT "Password" COLOR CLR_WHITE SIZE 120,14 PIXEL 
             oSay[2]:lTransparent := .T.

     @ 121,45 GET oGet[2] VAR cPass PICTURE '@!' COLOR CLR_BLACK, CLR_WHITE SIZE 140, 14 PASSWORD PIXEL ;
	      	  FONT oFnt2 ;
	      	  VALID (oBtn:lMouseOver.or.(!empty(cPass).and.iif(lChk := ChkPass(@cPass),oDlg:End(),(oGet[2]:Refresh(),.F.))))     

     @ 150, 45 SAY oSay[4] PROMPT 'Language' OF oDlg COLOR CLR_WHITE SIZE 30, 12 PIXEL FONT oFnt1
               oSay[4]:lTransparent := .T.

     @ 160, 45 COMBOBOX oCbx VAR cLang ITEMS {'Thai    ','English '} OF oDlg SIZE 60, 150 PIXEL FONT oFnt5

     @ 160, 130 SBUTTON oBtn PROMPT 'Exit' SIZE 60, 12 PIXEL FONT oFnt1 ;  //     				 TEXT ON_CENTER ;
					 ACTION ( lChk := .F. ,oDlg:End())

 
    ACTIVATE DIALOG oDlg CENTER
Regards,
Dutch
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

You may need to do it using fwh\samples\NewHelp.prg as a model.

Anyhow, we are going to build a new sample here, with controls, like in your sample.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
richard-service
Posts: 583
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Contact:

Post by richard-service »

Hi dutch,

Do you mean it?

Image

Code: Select all

DEFINE DIALOG oDlg RESOURCE cResource

   REDEFINE STSAY ID 100 OF oDlg RAISED

   REDEFINE LISTBOX oLbx VAR cGet ITEMS acList ID 300 of oDlg ;
             ON DBLCLICK ( i:=oLbx:GetPos(),lOK:=TRUE,oDlg:End() )

   oINQ_SK:= Dr_ZWin( oDlg, { GetSkinsDir()+"DRINQ.bmp" },;
                                               nRGB(236,215,210),,,.t.,.t. )

ACTIVATE DIALOG oDlg CENTER

Regards,

Richard
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear Richard,

No, I mean Antonio's mention but It looks nice.

I can do TRANSPARENT Dialog now.
.and.
Can I do TRANSPARENT (See Through) of BitMap ?

Code: Select all

    SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, , 230, 2 ) 
Thanks&Regards,
Dutch
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

This is a sample:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    MSGLOGO( "test.png", 2 )

    RETURN NIL


FUNCTION MSGLOGO( cImage, nSeconds )

    LOCAL oDlg, oTimer, oImage

    DEFAULT nSeconds := 5

    DEFINE DIALOG oDlg;
           SIZE 800, 600;
           STYLE WS_POPUP;
           BRUSH TBrush():New( "NULL" )

    DEFINE TIMER oTimer OF oDlg;
           INTERVAL nSeconds * 1000;
           ACTION oDlg:End()

    @ 0, 0 IMAGE oImage;
           FILE cImage;
           SIZE 800, 600;
           NOBORDER

    oImage:lTransparent = .T.

    ACTIVATE DIALOG oDlg;
             ON INIT ( oTimer:hWndOwner := oDlg:hWnd,;
                       oTimer:Activate(),;
                       SETTRANSP( oDlg ) );
             CENTER

    RETURN NIL


#define LWA_COLORKEY 1

#define GWL_EXSTYLE -20

#define WS_EX_LAYERED 524288


STATIC FUNCTION SETTRANSP( oDlg )

    SETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE, NOR( GETWINDOWLONG( oDlg:hWnd, GWL_EXSTYLE ), WS_EX_LAYERED ) )

    SETLAYEREDWINDOWATTRIBUTES( oDlg:hWnd, , , LWA_COLORKEY )

    RETURN NIL
EMG
Post Reply