Results 1 to 3 of 3

Thread: listbox / form help

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    39
    Hello People,

    I have a listbox which shows 5 items(strings).
    Those 5 items are pictures.

    When a user clicks on one of those items, I want the frmmain.picture to become that picture.

    example.
    Code:
    lstwallpaper.additem"Clouds"
    lstwallpaper.additem"Moon"
    lstwallpaper.additem"Lakes"
    lstwallpaper.additem"Sun"
    lstwallpaper.additem"Win2000"
    now when a user clicks on one of those I would like the form to take on that background.

    Here is what I have tried.

    Code:
    dim x%
    dim picture$
    
    picture$ = lstwallpaper.list(x%)
    frmmain.picture= picture$
    Thanks in advance

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'here's a start for you
    'remember your picture should be the size of your form
    'or you will have to tile it
    Code:
    Private Sub Command1_Click()
        List1.AddItem "C:\windows\waves.bmp"
    End Sub
    
    Private Sub List1_Click()
        Set Form1.Picture = LoadPicture(List1.Text)
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    In case you were wondering how to tile an image.
    Code:
    'tile an image on a form
    
    '1) Place an image control on a form and give it a picture
    '2) Set the forms AutoRedraw to False
    '3) Place this code in the Form Paint Event
    
    Dim intX As Integer
    Dim intY As Integer
    
    For intX = 0 To myForm.Width Step Image1.Width
        	For intY = 0 To myForm.Height Step Image1.Height
            	PaintPicture Image1, intX, intY
        	Next intY
    Next intX
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width