PNG Alpha Blended Form
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: PNG Alpha Blended Form

  1. #1
    Join Date
    Jul 2005
    Location
    Quebec, Canada
    Posts
    72

    Arrow PNG Alpha Blended Form

    OK, first, I want to say that I have found several threads for what I am searching for but none of them achieves the result I want. One close but the problem is that the controls in the form are not shown but still answer to mouse events. So here is my question and request:

    I would like to set a PNG image as a form with it's alpha channel (Transparency) but see the controls on the form. The one I found was using GDI+, which almost does what I want but I would like to know if it is possible to do this using DirectX if it would solve the hidden controls problem.
    David Richard

  2. #2
    Join Date
    Jul 2005
    Location
    Quebec, Canada
    Posts
    72

    Arrow Re: PNG Alpha Blended Form

    OK, I can see that no-one found a solution, or the post does not seem very interesting so I have posted two examples I have downloaded and tested for some people to work with.

    LoadPNG.zip is an example on how to load a PNG image in a PictureBox using GDI+.

    PerPixelAlpha.zip is a project example that shows how to use a PNG image as a form. You will see that the problem is that you cannot see the controls in the form but the controls still respond to mouse events.

    I need a solution. A form that has the picture and transparency of a given PNG image but that still shows the controls in the form. It's like a mixture of both projects that I need. If I can get the transparency of a PNG image from a PNG image loaded in a PictureBox, I won't need to repaint the actual form. I want to put PNG file effets on a form bu still show the controls I put on it. I am wondering if in DirectX mode, this would be achievable better than using GDI+. Does someone have a solution?
    Attached Files Attached Files
    Last edited by avidichard; October 26th, 2009 at 07:21 AM. Reason: Forgat Attachments
    David Richard

  3. #3
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,984

    Re: PNG Alpha Blended Form

    VB.Net lets you set OPACITY, as well as use Expressions Blend to create WPF forms to use, instead.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  4. #4
    Join Date
    Jul 2005
    Location
    Quebec, Canada
    Posts
    72

    Re: PNG Alpha Blended Form

    I am not using VB.NET and I can't use it since I will need to create my whole application completely. I don't want to do that. And, I won't use their VB6 to .Net Project converter because of the mess it does in the code and it doesn't even run after.

    As I can also see, I posted the thread in the Visual Basic 6 Formum for a reason. Thanks anyways for the comment.
    David Richard

  5. #5
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,984

    Re: PNG Alpha Blended Form

    Read up. You can mix VB.Net code and VB6 code in the same project. You can rewrite sections at a time, if you want features of one language (like opacity). Your VB6 app could use WPF forms
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Jul 2005
    Location
    Quebec, Canada
    Posts
    72

    Re: PNG Alpha Blended Form

    I searched the net to add WPF forms to a VB6 app and everything is oriented in the other way like hot to put a vb form in a WPF application. I use Visual Studio 6 (Visual Basic 6). I want to apply a PNG image to a form or PictureBox and see the PNG's transparency effect. That is the main reason of this thread.
    David Richard

  7. #7
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,984

    Re: PNG Alpha Blended Form

    It works the other way. Download Visual Studio 2008 - VB.Net Express Edition.

    This will let you LOAD the VB6 app, attempt to upgrade it, and let it execute when you add the .dll and .exe files to your project.

    It was all over the net a few years ago, when the vb.net toolset was being developed
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    Jul 2005
    Location
    Quebec, Canada
    Posts
    72

    Exclamation Re: PNG Alpha Blended Form

    Sorry for the delay.

    I once found a project created by someone on the net permitting to use a PNG image as a form with controls on it but I can't find it anymore. I know it is doable in VB6 and I don't want to convert the entire project in Dot Net since the all programs are done in VB6. Can someone help me do this project. I just want an alpha blended form from a PNG image with the controls shown.
    David Richard

  9. #9
    Join Date
    Apr 2009
    Posts
    394

    Re: PNG Alpha Blended Form

    Search over at vbforums... (I think in their codebank...)...




    Good Luck

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center