Solved

Transparent PictureBoxes

Posted on 2003-11-12
8
333 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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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