Results 1 to 13 of 13

Thread: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    I have made a picture viewer that can view alpha blended *.ICO files.

    - I open the ICO file and find the 32bpp icon that is the largest icon.
    - if there is no 32bpp (WinXP) style icon, it gets the 8 or 4bpp.
    - I send it to the PictureBox, which has a white background.
    - I click a copy button...
    Clipboard.SetDataObject(picBox.Image)

    When I paste it into say Windows Paint, it paints the background of the image blue. I want to maintain the white background.

    How can I copy the image with the white background?
    Or How can I take a snapshot of the Picture box and create a BMP image before copying?

    Thanks

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Here is a screenshot of what I am dealing with.

    I found some code on planet-source-code that allows the displaying of ICOn alpha transparency.... I tweaked it to find the largest icon in the file.

    Again... the icon shows a white background...(actually it's transparent - the picturebox is white)

    But, when I copy it to the clipboard, the transparency turns blue.

    Any ideas how to add the white background to the copy imaged??

    HELP!

    Attached Images Attached Images  

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Sorry for the "bumps"... but I have distributed an application on my site (Desktop Suite) that I have been trying to fix the alpha blending for over a year.

    I finally found a solution to at least display it... but now I can't copy it to the clipboard.

    I need some answers to my problem!

    See screenshot above of what it is doing.

    Thanks

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Can I use GetDC() and BitBlt() to get what is visible in the picture box (NOT the PictureBox.Image)???

    How could I use the GetDC and BitBlt??

    Thanks
    Last edited by penagate; Jul 3rd, 2007 at 09:53 AM.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Can somebody help me??


  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    I know you can use GDI to draw on a picturebox.

    How would I draw a white background under the icon and then combine them into one picture?


  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Will an expert GDI person help me.... pleeeasssssssssssssse!

    Ah oh, i'm begging now...


  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Well... What if I draw a white square on the picturebox first using GDI, then display the icon on top of the white square??

    If I could do this, then I would need a way of combining the two into one image. Then when I copy and paste into an app it will have the white background.

    What do you think??


  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Why isn't anybody helping me?


  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Well.... I guess I am posting to myself!!!

    Hey self... could you help me??


  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Okay... self.

    We are using this code to draw a fillrectangle on the picbox...

    Code:
        Private Sub picBox_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles picBox.Paint
            Dim g As Graphics = e.Graphics
            g.FillRectangle(Brushes.Teal, 0, 0, 128, 128)
        End Sub
    This code works fine.

    The problem is that when my icon loads into the picture box, it is under the fillrectangle.

    So, how do I get the icon (or any other image) to appear on top of my GDI fillrectangle??


  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Could anyone enlighten me on on how PictureBox layers work??

    Why is GDI drawn on top of the .Image property and an external image is loaded IN the .Image property.

    So, then How do I merge the two layers together?
    And How can I control which image or drawing draws on which layer?
    Is it possible to draw an external image on a GDI layer?

    Any info would be great!!


  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: [2005] Copy Icon From PicBx to ClipBoard (Alpha Blending)

    Hey self... you got any answers yet?


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