Antonio, thank you for the reply
I still have to test your solution
As well, i checked the screen-resolution and values :
( there was something wrong on my sample )
For screen 1024 x 768
- Code: Select all Expand view RUN
ACTIVATE DIALOG oDlg ;
ON INIT ( oDlg:Move( 384, 512, oDlg:nWidth, oDlg:nHeight, .f. ) )
That looks much better
Top / left of the dialog starts at the window-center :
But it seems, it is not 100 % the calculated position ?
The reason for all this is :
I want to make it possible, to draw frames, underlines and more
with alpha-bmp's in relation to any object in a resource.
a working sample : a alpha-bmp placed to the 4 corners of a xbrowse.
In the moment, I'm preparing a nice collection of frames, borders and underlines as alpha-bmp's for the forum.
World.bmp resized and used as a Browser-background
For this, i have to do a exact calculation.
To use Alpa-Bmp's for lines it would be nice,
the bmp could be adjusted with < bottom and right >
to the related resource.
like :
ABPaint( hDC1, Top, Left, Bottom, Right, oBmp3:hBitmap, 220 )
The complete calculation sample :
- Code: Select all Expand view RUN
#include "FiveWin.ch"
#include "InKey.ch"
#include "xbrowse.ch"
//----------------------------------------------------------------------------//
FUNCTION Main()
local oWnd, oBmp, hDC, oBmp2, aCORS
DEFINE BITMAP oBmp2 FILENAME "World.bmp"
DEFINE BRUSH oBmp RESOURCE "Background"
DEFINE WINDOW oWnd TITLE "New TXBrowse class (only for FWH)" ;
BRUSH oBmp ;
MENU BuildMenu( oWnd, oBmp2 ) MDI ;
MENUINFO 3
SET MESSAGE OF oWnd TO FWVERSION + ", " + FWCOPYRIGHT CENTERED TIME DATE
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON PAINT ABPaint( hDC, 10, 10, oBmp2:hBitmap, 220 ) // 0-255 transparency level
RETURN NIL
//----------------------------------------------------------------------------//
function BuildMenu( oWnd, oBmp2 )
local oMenu
local cFile
cFile := cFilePath( GetModuleFileName( GetInstance() ) ) + "readme.txt"
MENU oMenu
MENUITEM "Dialog browse" ACTION NewDialog( oWnd, oBmp2 )
ENDMENU
RETURN oMenu
//----------------------------------------------------------------------------//
STATIC FUNCTION NewDialog( oWnd, oBmp2 )
local oDlg, oBrw, hDC1, oBmp3, hWnd
DEFINE BITMAP oBmp3 FILENAME "World.bmp"
DEFINE DIALOG oDlg RESOURCE "TEST" OF oWnd
*aCORS := GetCoors( oWnd:hWnd )
*MsgAlert( aCORS[1] )
oBrw := TXBrowse():New( oWnd )
REDEFINE XBROWSE oBrw ID 101 ;
HEADERS "An array", "test" ;
OF oDlg ;
ARRAY { { "first", "row" }, { "second", "row" } } AUTOCOLS
// GETCOORS
// 4 elements: { 1 = nTop, 2 = nLeft, 3 = nBottom, 4 = nRight }
ACTIVATE DIALOG oDlg ;
ON INIT ( oDlg:Move( 150, 200, oDlg:nWidth, oDlg:nHeight, .f. ) ) ;
ON PAINT ( hDC1 := oDlg:GetDC(), ;
aRect1 := GETCOORS( oBrw:hWnd ), ;
nTOPPOS := oBrw:nTop, ;
nLEFTPOS := oBrw:nLeft, ;
nBOTTOMPOS := nTOPPOS + ( aRect1[3] - aRect1[1] ), ;
nRIGHTPOS := nLEFTPOS + ( ( aRect1[4] - aRect1[2] ) ), ;
ABPaint( hDC1, nLEFTPOS-50, nTOPPOS-50, oBmp3:hBitmap, 220 ), ;
ABPaint( hDC1, nRIGHTPOS-50, nTOPPOS-50, oBmp3:hBitmap, 220 ), ;
ABPaint( hDC1, nLEFTPOS-50, nBOTTOMPOS-50, oBmp3:hBitmap, 220 ), ;
ABPaint( hDC1, nRIGHTPOS-50, nBOTTOMPOS-50, oBmp3:hBitmap, 220 ) )
RETURN NIL
Best regards
Uwe