Hello,
I got it working, with placing a Dialog on the Main-Window.
But there is a problem, to place the dialog on a exact defined position.
I wanted to calculate the Dialog-Position with
GetSysMetrics of the Main-Window
but I had to adjust the values of the Dialog-size/position step by step to cover the needed area.
Even the gradientfill of the Dialog I had to adjust.
Is it possible anyhow, to calculate a exact position of a Dialog ?
The normal calculation to place the Dialog with width : 32 Pixel on top of the window would be :
nWidth := GetSysMetrics(0)
nHeight := GetSysMetrics(1)
oDlg:Move( 20, nWidth - 32, 32, nHeight - 40, .f. )
20 Pixel from Top
Dialog Left =
nWidth - 32Dialog Width =
32Dialog Hight =
nheight - 40 ( 20 Pixel for Title and 20 Pixel for Bottom )
It doesn't work. I had to change in :
oDlg:Move( 20, nWidth - 65, 70, nHeight - 75, .f. )
to cover the exact area.
- Code: Select all Expand view
FUNCTION B_BAR(oWnd)
LOCAL nWidth := GetSysMetrics(0), nHeight := GetSysMetrics(1)
nStyle = nOR( WS_OVERLAPPED | WS_VISIBLE )
DEFINE DIALOG oDlg FROM 0, 0 TO 100, 100 OF oWnd STYLE nSTYLE PIXEL TRANSPARENT
@ 0, 0 BTNBMP oBtn50 OF oDlg ;
SIZE 32 , 40 PROMPT " " + CRLF + "Project" 2007 ;
FONT oBTFont1 TOP RESOURCE "magic" ;
ACTION ( Tools(oWnd), lOPEN := .T., oBtn50:Disable() )
oBtn50:lTransparent = .T.
oBtn50:cTooltip := "Background" + CRLF + "Edit"
oBtn50:lBorder := .F.
@ 40, 0 BTNBMP oBtn51 OF oDlg ;
SIZE 32 , 40 PROMPT "Create" + CRLF + "EXE-File" 2007 ;
FONT oBTFont1 TOP RESOURCE "magic" ;
ACTION MAKE_EXE()
oBtn51:lTransparent := .T.
oBtn51:cTooltip := "New EXE-File"
oBtn51:lBorder := .F.
@ 80, 0 BTNBMP oBtn52 OF oDlg ;
SIZE 32 , 40 PROMPT " " + CRLF + "Preview" 2007 ;
FONT oBTFont1 TOP RESOURCE "preview" ;
ACTION MsgInfo("Hello")
oBtn52:lTransparent := .T.
oBtn52:cTooltip := "Background" + CRLF + "Edit"
oBtn52:lBorder := .F.
@ 120, 0 BTNBMP oBtn53 OF oDlg ;
SIZE 32 , 40 PROMPT " " + CRLF + "Help"2007 ;
FONT oBTFont1 TOP RESOURCE "help" ;
ACTION IIF( FILE( "BackgrdHelp.exe" ), Winexec("BackgrdHelp.exe"), ;
MsgAlert( "No HelpFile : BackgrdHelp.exe", "Error" ) )
oBtn53:lTransparent := .T.
oBtn53:cTooltip := "Help" + CRLF + "Edit"
oBtn53:lBorder := .F.
@ 160, 0 BTNBMP oBtn54 OF oDlg ;
SIZE 32 , 40 PROMPT " " + CRLF + "Quit" 2007 ;
FONT oBTFont1 TOP RESOURCE "quit" ;
ACTION oWnd:End()
oBtn54:lTransparent := .T.
oBtn54:cTooltip := "Quit"
oBtn54:lBorder := .F.
ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON INIT oDlg:Move( 20, nWidth - 65, 70, nHeight - 75, .f. ) ;
ON PAINT GradBar( hDC, oDlg )
RETURN( NIL )
// -----------------------------------------------
STATIC FUNCTION GradBar( hDC, oDlg )
local aGrad := { { 0.50, 16054371, 11892819 } }
GradientFill( hDC, 0, 0, oDlg:nHeight + 10, oDlg:nWidth, aGrad, .T. )
RETURN NIL
Regards
Uwe