Results 1 to 2 of 2

Thread: Help with *.Backgroundimage

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2002
    Location
    Cecilton, MD USA
    Posts
    278

    Help with *.Backgroundimage

    is there a way i can see if the backgroundimage of an object (ie. a button) and see if it is a picture or anything?.....here is what i want to do.........

    when a button is clicked change the background...if no current image is there put the image in there.....if the image is already there....make it blank again........is there anyway to do this????

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Add an imagelist to the form, and add a graphic to it and set your button imagelist and image index. I here by consider the image index to be 0. Then:
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.     Static imageisthere As Boolean
    3.     If Not imageisthere Then
    4.             Button1.ImageList = Nothing
    5.             imageisthere = True
    6.     Else
    7.             Button1.ImageList = ImageList1
    8.             Button1.ImageIndex = 0
    9.             imageisthere = False
    10.     End If
    11. End Sub
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

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