Results 1 to 2 of 2

Thread: [RESOLVED] Changing transparent background image

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    217

    Resolved [RESOLVED] Changing transparent background image

    I've made a program with a transparent background image using the following code in the form_load sub.
    Code:
            Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
            Me.BackColor = Color.Transparent
            Dim img As Bitmap = CType(Me.BackgroundImage, Bitmap)
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
            Me.TransparencyKey = img.GetPixel(2, 2)
    I have a timer set to 1 second, that I want to use to change the background. I tried this code to change the picture every second.
    Code:
                Beat = Beat + 1
                If Beat = 1 Then Me.BackgroundImage = My.Resources.ResourceManager.GetObject("Heart1.png")
                If Beat = 2 Then Me.BackgroundImage = My.Resources.ResourceManager.GetObject("Heart2.png") : Beat = 0
    This causes the window to revert to grey.

    Any ideas? Thanks.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Dec 2008
    Posts
    217

    Re: Changing transparent background image

    Turns out I should have been using Me.BackgroundImage = My.Resources.Heart1.

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