Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Background Screen Setting
Message
From
12/01/2021 09:54:14
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Background Screen Setting
Miscellaneous
Thread ID:
01677804
Message ID:
01677804
Views:
67
Howdy all,

I am trying to setup a background screen image upon FP 9.0 application opening up (after succesful login). The code listed below works but when I run it on different monitor sizes, the image isn't centered on the monitor. Is there a way to ensure that regardless of which size the monitor is, the screen background image is centered on the monitor size?

lcImage = "mainlogo_g.png"

lcBgType = "center"

IF NOT PEMSTATUS(_Screen, "oImg", 5)
_Screen.AddObject("oImg", "Image")
ENDIF

WITH _Screen.oImg
.Visible = .F.
.Stretch = 0
.Picture = lcImage
DO CASE
CASE lcBgType == "STRETCH"
.Top = 0
.Left = 0
.Stretch = 2
.Height = _Screen.Height
.Width = _Screen.Width
CASE lcBgType == "ISOMETRIC"
.Stretch = 1
.Height = _Screen.Height
.Width = _Screen.Width
.Top = (_Screen.Height - .Height) / 2
.Left = (_Screen.Width - .Width) / 2
CASE lcBgType == "CENTER"
.Stretch = 0
.Top = (_Screen.Height - .Height) / 2
.Left = (_Screen.Width - .Width) / 2

OTHERWISE
.Top = 0
.Left = 0
.Stretch = 0
ENDCASE
.Visible = .T.

endwithlcImage = "mainlogo_g.png"
* Center Image
*lcBgType = "CENTER"
* Stretch image
lcBgType = "center"

IF NOT PEMSTATUS(_Screen, "oImg", 5)
_Screen.AddObject("oImg", "Image")
ENDIF

WITH _Screen.oImg
.Visible = .F.
.Stretch = 0
.Picture = lcImage
DO CASE
CASE lcBgType == "STRETCH"
.Top = 0
.Left = 0
.Stretch = 2
.Height = _Screen.Height
.Width = _Screen.Width
CASE lcBgType == "ISOMETRIC"
.Stretch = 1
.Height = _Screen.Height
.Width = _Screen.Width
.Top = (_Screen.Height - .Height) / 2
.Left = (_Screen.Width - .Width) / 2
CASE lcBgType == "CENTER"
.Stretch = 0
.Top = (_Screen.Height - .Height) / 2
.Left = (_Screen.Width - .Width) / 2

OTHERWISE
.Top = 0
.Left = 0
.Stretch = 0
ENDCASE
.Visible = .T.

endwith
Thanks in Advance.

J. Turner
Next
Reply
Map
View

Click here to load this message in the networking platform