Solved

Transparent PictureBoxes

Posted on 2003-11-12
8
321 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
8 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 140 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

863 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now