Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Centering an image in a form, regardless of form size
Message
From
16/03/2005 11:33:31
 
 
To
16/03/2005 08:34:34
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00996271
Message ID:
00996377
Views:
39
Here is what I used to make it work in vfp9.
PUBLIC oHandler, cScreen
oHandler=NEWOBJECT("myhandler")
_SCREEN.AddObject("MyScreen1","MyScreen")
BINDEVENT(_SCREEN,"Resize",oHandler,"myresize")

DEFINE CLASS MyScreen AS Custom
   cScreen = _SCREEN

   PROCEDURE Init
       this.cScreen = _SCREEN
       this.cScreen.AddObject("Image1","Image")
       WITH this.cScreen.Image1
*!* This commented out will use default size of picture
*!*	           .Height = 400
*!*	           .Width  = 800
           .Stretch = 2
           .Picture = "MyImage.jpg"
           .Visible = .t.
           .Left = INT((this.cScreen.Width  - .Width)/2)
           .Top  = INT((this.cScreen.Height - .Height)/2)
       ENDWITH
   ENDPROC
ENDDEFINE

DEFINE CLASS myhandler AS Session
   cScreen = _SCREEN

   PROCEDURE myresize
       this.cScreen = _SCREEN
       WITH this.cScreen.Image1
           .Left = INT((this.cScreen.Width  - .Width)/2)
           .Top  = INT((this.cScreen.Height - .Height)/2)
       ENDWITH
   ENDPROC

ENDDEFINE
Previous
Reply
Map
View

Click here to load this message in the networking platform