Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Transparent PictureBoxes

Posted on 2003-11-12
8
Medium Priority
?
363 Views
Last Modified: 2010-05-01
I need my program to have PictureBoxes that are transparent. I don't just mean have pictures that are coloured the same as the Form, I want to be able to see controls behind them.

Any ideas?
Thanks,
adbabypenguin
0
Comment
Question by:adbabypenguin
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:monkesdb
ID: 9736043
Picture1.Visible = False
0
 

Author Comment

by:adbabypenguin
ID: 9736172
Oh yeah... I want to have a picture displayed in the Boxes as well... Picture1.Visible=False ain't much help
0
 
LVL 3

Expert Comment

by:monkesdb
ID: 9736347
Picture1.ZOrder = -1 (i think)

or you can just "Send to back" in the editor.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:adbabypenguin
ID: 9744271
Let me make it clear what I want to do:

I have a file called House.bmp. It has a blue background. On top of the background, there is a house.

I also have a file called School.bmp. It also has a blue background. On top of the background, there is a school.

There are two Picture Boxes.
One is Pic1, The other Pic2.
They contain the two pictures.
Pic2 partly overlaps Pic1.
I want the blue part of the image to be transparent, so that I can see part of the image behind it.
0
 
LVL 3

Accepted Solution

by:
monkesdb earned 560 total points
ID: 9752247
right, this makes it more clear. if you want it all to appear inside the picturebox with the house then this is how to do it. otherwise, if they need to overlap then you should paint the picture of the house onto something else and then to this ontop of that. but here you get the basic idea.

Go to the API Viewer and add BitBlt.

you need to create a mask so black is what you don't want to show through and white is what will.

PicSchoolMask.Picture = LoadPicture("C:\...mask.jpg")
PicSchoolMask.Visible = False

PicSchool.Picture = LoadPicture("C:\...image.jpg")
PicSchool.Visible = False

PicHouse.Picture = LoadPicture("C:\...house.jpg")

TheHeight = PicSchool.ScaleHeight
TheWidth = PicSchool.ScaleWidth

BitBlt PicHouse.hDC, X, Y, TheWidth, TheHeight, PicSchoolMask.hDC, 0, 0, vbSrcAnd
BitBlt PicHouse.hDC, X, Y, TheWidth, TheHeight, PicSchool.hDC, 0, 0, vbSrcPaint
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10548203
Moderator, my recommended disposition is:

    Accept monkesdb's comment(s) as an answer.

Dan Rollins -- EE database cleanup volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question