FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Centralize image in window
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Centralize image in window
Posted: Wed May 06, 2015 08:25 PM

How can I centralize an image in the center of the window regardless the user resize the window, maximize, etc?

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Centralize image in window
Posted: Wed May 06, 2015 09:51 PM
The needed calculation on window-resize
( I can add a compiled sample + source if needed )

Logo :

@ nLTop, nLLeft IMAGE oLogo ; // Top / Left
FILENAME c_Path1 + cLogo ;
NOBORDER ;
OF oWnd PIXEL UPDATE TRANSPARENT


The calculation to center the image-position on window-resize :

oWnd:bResized := {|| nLTop := INT( ( ( oWnd:nHeight ) / 2 ) - ( oLogo:nHeight / 2 ) ), ;
nLLeft := INT( ( ( oWnd:nWidth - 18 ) / 2 ) - ( oLogo:nWidth / 2 ) ), ;
oLogo:Move( nLTop, nLLeft, , , .T. ) }


best regards
Uwe :-)
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.
Posts: 389
Joined: Mon Oct 13, 2008 11:26 AM
Re: Centralize image in window
Posted: Wed May 06, 2015 09:58 PM

Worked fine! Thanks!

Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Centralize image in window
Posted: Wed May 06, 2015 10:04 PM
The results

Full screen



Resized



best regards
Uwe :-)
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.

Continue the discussion