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

    How can you make a bitmap flash (i.e. load then unload)?

    Hi,

    I have a main picture box(MainPic1) and two other Pictures in boxes (Pic1) and (Pic2). I also have a button. When I press the button, the main picture box becomes pic1, but I want it to change the picture continuously until the button is pressed again, to make it look if the picture is flashing (i.e. alternating between the two). Is it possible to do this? Any Code?

    Thanks

    Mark


  2. #2
    Join Date
    Apr 2000
    Location
    Chicago
    Posts
    18

    Re: How can you make a bitmap flash (i.e. load then unload)?

    Use a timer control and mess around with it's Interval property to change the flash rate, an use a static variable (value is held between function calls) to switch between the two pictures.

    Private Sub Timer1_Timer()
    Static b As Boolean

    If b Then
    MainPic1.Picture = Pic1.Picture
    Else
    MainPic1.Picture = Pic2.Picture
    End If

    b = Not b
    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

Featured