Results 1 to 3 of 3

Thread: Adding Pictures

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2001
    Location
    Maine
    Posts
    214

    Adding Pictures

    how would i make it so that it adds a picture box with a picture loaded onto the form, without me puttin the box on the form before i run the program?

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    -= a peet post =-

  3. #3
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    The thread peet gave pretty much covers it but since I already typed this out here you go.
    VB Code:
    1. Option Explicit
    2.  
    3. Dim WithEvents cmd As CommandButton
    4. Dim pic As PictureBox
    5.  
    6. Private Sub cmd_Click()
    7.     Set pic = Controls.Add("VB.PictureBox", "pic")
    8.     With pic
    9.         .Top = cmd.Height
    10.         .Left = 0
    11.         .AutoRedraw = True
    12.         .AutoSize = True
    13.         .Picture = LoadPicture("C:\My Documents\logo.bmp")
    14.         .Visible = True
    15.     End With
    16.        
    17. End Sub
    18.  
    19. Private Sub Form_Load()
    20.     Set cmd = Controls.Add("VB.CommandButton", "cmd")
    21.     With cmd
    22.         .Left = 0
    23.         .Top = 0
    24.         .Caption = "Add Picture"
    25.         .Visible = True
    26.     End With
    27. End Sub

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