|
-
Feb 19th, 2002, 02:00 PM
#1
Thread Starter
New Member
Multiple layered graphics window
Hello All.
I am trying to create a usercontrol that has a picturebox on it.
On top of the picturebox I would like to create a separate transparent usercontrol on which I can draw graphics. The problem is that when I create the "upper layer" usercontrol and set it's backstyle to "transparent", the underlying picture can be viewed, but none of the graphics that I draw on the upper layer foreground are visible.
It appears that setting the backstyle to opaque is the only way to see my drawn graphics - but this defeats the purpose because the underlying picture can no longer be viewed.
Is there a way to create a usercontrol that has a transparent background, yet I can draw on the foreground and have the underlying picture show through?
Thanks, BTT
-
Feb 19th, 2002, 03:34 PM
#2
Fanatic Member
Windows 2K or XP uses layered window styles. Then u can use the API SetLayeredWindowAttributes
-
Feb 19th, 2002, 04:47 PM
#3
Frenzied Member
well just take 2 dcs and blt them ontop of each other on the picturebox that is showing. If you need real transperancy go to www.ur.co.nz there is some nice sample on transperancy (only 8 bit though)
Sanity is a full time job
Puh das war harter Stoff!
-
Feb 19th, 2002, 08:18 PM
#4
Hi, you just need 1 user control to do this. Simply blit the
background image to the hDc. The foreground image will require
a little more work. You will actually need two images. The first
image is called a 'mask'. Just take the original image and ensure
that the pixels you want displayed are made black (0, 0, 0) and
the pixels you do not want displayed are made white (255, 255,
255). Now your mask is complete. Go ahead and modify the
original image and ensure that all the pixels you DONT want
displayed are black (0, 0, 0) and the rest remain untouched.
Now you simply blit the mask with an AND operation on top of
the background and then blit the slightly modified original image
with an OR - or - XOR operation and you are done.
-CC
-
Feb 19th, 2002, 09:42 PM
#5
Thread Starter
New Member
Thanks all
I will give these suggestions a try and see what I come up with. Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|