CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Location
    United Kingdom
    Posts
    60

    Can't get Bitmap to show up...

    Hi all,

    On my form I have a picture box called "Picture1" and a button called "Command1", here is the code that is in the button:

    If Picture1.Picture = LoadPicture(App.Path & "\Folder1\" & "PicA" & ".BMP") Then

    Picture1.Picture = LoadPicture(App.Path & "\Folder1\" & "PicB" & ".BMP")
    End If

    I have checked the folder to ensure that these two pictures exist, but when I click the button, the picture does not change.

    Any Info on how I can get this to work??

    Thanks

    Mark

  2. #2
    Join Date
    Apr 2002
    Posts
    174
    if you use LoadPicture(..) funtion then you get an handle to the pitcure. 2 calls to the LoadPicture() with same picture parameter can return different handle. I suggest you that you can use a flag variable to set and check the current picture showed.


    If (NowPic = "PicA" & ".BMP") Then
    Picture1.Picture = LoadPicture(App.Path & "\Folder1\" & "PicB" & ".BMP")
    NowPic="PicB" & ".BMP"
    End If


    and initialize the NowPic variable with the picture that is in the Picture1 (.. maybe "PicA" & ".BMP") at the start of program.

    I hope i can help you...

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