Add Background Image to VFP desktop
The code below shows how to add a background image to the VFP desktop using the VFP Image control.
This is sample code. Add error handling and adjust to your requirements as necessary. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 lcImage = "Whatever.jpg" * Center Image lcBgType = "CENTER" * Stretch image *lcBgType = "STRETCH" * Stretch image while maintaining its original proportions *lcBgType = "ISOMETRIC" 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
Comments
Picture to window's clipboard
Copy image to clipboard
You may also check <a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=VFPX&title=GDIPlusX">GdiPlusX library</> from <a href="http://www.codeplex.com/VFPX">VFP<sub>x</sub></a>
Use HTML as background
I would like to create a different background (based on text) every time i start my application...
Use Web Browser control to display HTML
Basicly, you create AlwaysOnBottom form with Web Browser control on it and use BindEvent() to bind to Screen.Resize() to make sure that it covers VFP desktop if it ever resized.
nice post, thanks
Thanks to this post. Nice