Solved

Transparent PictureBoxes

Posted on 2003-11-12
8
342 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

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

Technology Partners: 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!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 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…

751 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