Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15122

Picturebox w/ transparency

$
0
0
Hey everyone,
I know this topic has been brought up in the past, but I'm having some trouble, and while I think I know why, I want to get your thoughts on it and maybe find a workaround besides redrawing graphics pixel by pixel for my tile/map editor.

Here's the setup:
I have a pic box (container) with a picture box (canvas). I want to do 2 layers of graphics inside of this pic box (canvas). Working on the lower layer isn't so much of an issue, but getting the graphics to be drawn over the "bottom layer" and having transparency is giving me some trouble.

I tried using TransparentBlt, but I think what I need and its requirements don't mesh well. Right now I have the tiles loaded on an MDI form pic box, and I just paintpicture the tile into its own picbox (as a preview). When I draw it on the canvas pic box, I need the transparency to work. If I use TransparentBlt, I have to turn off the auto redraw, which overwrites the tile outline grid (line objects rather than drawn directly onto the pic box as it seems that's faster than using the .line method).

So, okay, I'm seeing that I need auto redraw. So I make a temporary container, hidden, but then I can't get paintpicture the image. After reading up on it, it seems because that auto redraw is off, there's no buffer for the picture data, and if it's off screen or hidden, the data gets (more or less) destroyed. (my thought was to draw the lower layer into this temporary pic box, then transparentblt the higher layer, then copy the entire thing and paste it onto the canvas pic box)

Since this doesn't seem to work as I thought, I can only come up with the idea that I have to redraw each pixel and omit the color index, but when working with meta tiles that are up to 64x64 pixels in size, that could become incredibly slow to redraw the pixels by hand.

I hope I explained that clearly, if not let me know.

What are my options to be able to do this?

Also, it seems that I can only have a max height and width of a picturebox at 2048 pixels (doesn't seem to larger than this). Any ideas on why that is?

Thanks!

Viewing all articles
Browse latest Browse all 15122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>