Page 1 of 1

Logo on MDI window.

Posted: Sat Jan 02, 2021 11:27 pm
by byron.hopp
I use to do this using the old Harbour compiler. But since I moved to Borland my program gets hung up when clicking on the menu.

Here is the old code I used in the main program just before the Activate Window:
@ 0,0 Bitmap oLogo File Mcs_AppPath() + "Images\EocwdLogo.bmp" of oWnd:oWndClient PIXEL NOBORDER
oWnd:CoorsUpdate()
oWnd:bPainted := {|| SetLogo( oLogo,oWnd )}

Here is the function that runs during the paint event.
Function SetLogo( oLogo,oWnd )
Local nX,nY
oWnd:CoorsUpdate()
oWnd:oWndClient:CoorsUpdate()
oLogo:CoorsUpdate()
oLogo:Hide()

nX := oWnd:oWndClient:nWidth() - oLogo:nWidth() - 10
nY := oWnd:oWndClient:nHeight() - oLogo:nHeight() - 10
oLogo:Move( nY,nX,oLogo:nWidth(), oLogo:nHeight(),.t. )

oLogo:Show()
return NIL

Re: Logo on MDI window.

Posted: Sun Jan 03, 2021 4:46 pm
by Antonio Linares
Byron,

I have modified your code and it is working fine with Borland and Microsoft:

Code: Select all

#include "FiveWin.ch"

function Main()

   local oWnd, oLogo

   DEFINE WINDOW oWnd MDI

   @ 0, 0 Bitmap oLogo File "c:\fwh\bitmaps\fivetech.bmp" of oWnd:oWndClient PIXEL NOBORDER

   oWnd:oWndClient:bPainted := { || SetLogo( oLogo,oWnd ), 1 }
   oWnd:bResized := { || SetLogo( oLogo, oWnd ) }

   ACTIVATE WINDOW oWnd

return nil

function SetLogo( oLogo, oWnd )

   local nX, nY
   
   nX := oWnd:oWndClient:nWidth() - oLogo:nWidth() - 10
   nY := oWnd:oWndClient:nHeight() - oLogo:nHeight() - 10
   oLogo:Move( nY, nX, oLogo:nWidth(), oLogo:nHeight(), .T. )

return nil

Re: Logo on MDI window.

Posted: Sun Jan 03, 2021 7:31 pm
by byron.hopp
Perfect...

Thank you,

Re: Logo on MDI window.

Posted: Sun Jan 03, 2021 7:52 pm
by nageswaragunupudi
May I suggest another alternative?

Code: Select all

#include "FiveWin.ch"

function Main()

   local oWnd

   DEFINE WINDOW oWnd MDI

   oWnd:oWndClient:bPainted := ;
      { || oWnd:oWndClient:DrawImage( "c:\fwh\bitmaps\fivetech.bmp", ;
           { nil, nil, -10, -10 }, .f., nil, nil, nil, "BR" ) }

   ACTIVATE WINDOW oWnd

return nil
 

Re: Logo on MDI window.

Posted: Sun Jan 03, 2021 8:34 pm
by Antonio Linares
The shortest, the nicest :-)

Thank you Rao