Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programatically center an image control..
Message
 
 
To
10/01/2007 12:07:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6
Miscellaneous
Thread ID:
01182600
Message ID:
01184254
Views:
25
>>It's still the same, it won't center. :(
>>
>>What is wrong?
>Try:
>
>oForm = CREATEOBJECT([Form1])
>oForm.Show(1)
>
>**************************************************
>*-- Form:            form1 (d:\all_zapl_4_9_0\test.scx)
>*-- ParentClass:     form
>*-- BaseClass:       form
>*-- Time Stamp:      01/10/07 07:04:06 PM
>* 75 is the picture control height
>
>DEFINE CLASS form1 AS form
>
>
>    Top = 0
>    Left = 0
>    Height = 656
>    Width = 765
>    DoCreate = .T.
>    Caption = "Form1"
>    ForeColor = RGB(255,255,255)
>    Name = "Form1"
>
>
>    PROCEDURE Init
>        CREATE CURSOR crsTest (pathToImage M)
>        SET ASSERT ON
>        lcImage = GETDIR()
>        IF NOT EMPTY(lcImage)
>           lnFile = ADIR(laFile, ADDBS(lcImage)+[*.BMP])
>           FOR lnFor = 1 TO lnFile
>               INSERT INTO crsTest VALUES (ADDBS(lcImage)+laFile[lnFor,1])
>           NEXT
>        ELSE
>           RETURN .f.
>        ENDIF
>        lnCount        = 0
>        lnPictPerRow   = MIN(FLOOR(thisform.Width / 75), RECCOUNT([crsTest]))
>        lnSpaceBetween = (thisform.Width - lnPictPerRow * 75) / (lnPictPerRow+1)
>        lnTop          = 0
>        lnLeft         = lnSpaceBetween
>        SCAN
>           lcName = SYS(2015)
>           thisform.AddObject(lcName,[Image])
>           WITH EVALUATE([thisform.]+lcName)
>                .visible     = .t.
>                .stretch     = 1
>                .width       = 75
>                .height      = 75
>                .top         = lnTop
>                .left        = lnLeft
>                .picture     = pathToImage
>                .borderstyle = 1
>           ENDWITH
>           lnCount = lnCount + 1
>           IF lnCount >= lnPictPerRow
>              lnTop   = lnTop + 80
>              lnLeft  = lnSpaceBetween
>              lnCount = 0
>           ELSE
>              lnLeft = lnLeft + 75 +lnSpaceBetween
>           ENDIF
>        ENDSCAN
>    ENDPROC
>
>
>ENDDEFINE
>
Very nice.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform