We do the following:
In the ancestor OPEN event of the mdi_frame window of the application:
// Open Bkg window
OpenSheet(w_bkg,this)
il_wbkg_w = w_bkg.width
il_wbkg_h = w_bkg.height
this.FUNCTION of_center_wallpaper ()
Where:
w_bkg = a child window inherited from w_master, located in the Class Library, in our case in CORP_PFE.
this = w_app_frame, inherited from w_frame.
// We wanted to keep the code generic when centering the wallpaper in case the image changed.
integer wx, wy, wh, ww
// Get current MDI workspace
wx=this.workspacex ( )
wy=this.workspacey ( )
wh=this.workspaceheight ( )
ww=this.workspacewidth ( )
// Set background image
If ( handle (w_bkg) > 0 ) then
wh -= 200 // Approx Microhelp Height??
w_bkg.width=il_wbkg_w
w_bkg.height=il_wbkg_h
If ww>w_bkg.width Then
ww = Integer((ww - w_bkg.width) / 2)
Else
ww = 1
End If
If wh>w_bkg.height Then
wh = Integer((wh - w_bkg.height) / 2)
Else
wh = 1
End If
Move(w_bkg, ww, wh)
End If
// Be sure focus is on us and not the background image
SetFocus(this)
Later -
Olan