CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Posts
    1

    How can i paint a image box?

    I need to create a transparent image while in run time, unfountunately picture box doesn't support transparent images, i need image boxes to get the job done, but i don't know how to create a image box while in run time, please help.


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: How can i paint a image box?

    If you have VB6, you can use the Add Method of the Forms Controls Collection, ie.

    private Sub Command1_Click()
    me.Controls.Add "VB.Image", "Image1"
    me!image1.Move 0, 0
    me!image1.Picture = LoadPicture("C:\Files\mypic.gif")
    me!image1.Visible = true
    End Sub



    Otherwise you can create a single Image control at Design time and set its Index Property to Zero, creating a Control Array, then:

    private Sub Command1_Click()
    Load Image1(Image1.Count)
    Image1(Image1.Count - 1).Move 0, 0
    Image1(Image1.Count - 1).Picture = LoadPicture("C:\Files\mypic.gif")
    Image1(Image1.Count - 1).Visible = true
    End Sub




    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

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

Featured