Form Transparency and PNG Drawing

Good evening everybody.

I’ve been researching for hours upon hours on how to place a PNG image onto frmMenu. I’ve got as far as getting the form to be transparent, but I can’t seem to load the PNG using any of the methods I’ve found online. The closest I got was inserting the PNG into a picture box, but obviously there was no transparency.

Is there a way to draw the PNG using the existing code from the engine? Using SkyWyre v10.

Use LaVolpe alpha image control.
Add it in components

I’m pretty sure you can use a gif as an image on the form, it should support transparency.

I’ve tried working with LaVolpe’s stuff but it doesn’t work. When I ported it over to my project, the image didn’t display.

I’m going to try something else. I have some code that makes everything on the form transparent if the object is coloured vbCyan. So what I’m going to do is use a picture box and draw the image in using the current code in the project. The picture box will be coloured vbCyan so hopefully that should get the transparency and the PNG will be drawn with DirectX rather than just loaded.

I’ll let you guys know how it goes and if it works I’ll share the method with people, if they want it.

Well it seems I couldn’t get this to work the way I wanted to yet. I want it to draw a paperdoll onto picSprite on frmMenu, but in order to draw things, it first draws a black box, and I don’t want it to do that as picSprite has a background image already.

This is so incredibly frustrating.

Update: I managed to find some source that allows me to load a PNG into an ImageBox. This will suffice for now. I would have preferred to draw the image to a picture box that already has a loaded background image but the way the current graphics rendering script works I’m not sure if that will be possible. I may have a play around with it though as it doesn’t seem right that I can only get a black background when drawing to picSprite.

I’ve been playing around with this line which is responsible for that black background. I can change the colours, but alpha blending doesn’t seem to be possible with it.

Direct3D_Device.Clear 0, ByVal 0, D3DCLEAR_TARGET, D3DColorRGBA(0, 255, 0, 0.5), 1#, 0

LaVolpe is super easy to use. Idk what went wrong but in my case adding it to the components and placing on the form was easy.
To se image to the control you right click on the image and then properties.
You can edit things there.
You wont find any image control that is better than lavolpe for sure.

I managed to get one of LaVolpes snippets to work, and that was PNG to ImageBox. This is great, but I would much rather have the images drawn to a PictureBox, which I can do using existing code in the engine, but as I said above, I get that black box, which I don’t want, and I don’t believe it’s as simple as changing an alpha value.

@xlithan Any reason you aren’t just drawing to frmMenu? You said cyan was made transparent, have you tried making the backcolor of D3DColorRGBA(0, 255, 0, 0.5) into cyan?

I don’t know much about LaVolpe so I can’t help with that.

I tested it a bit more and it does technically work, there is a lot of cyan placed around things, so I don’t recommend doing it. Looks like you’ll need to learn LaVolpe

Anything cyan will be transparent through the whole form. So if you have a cyan PictureBox, you’ll actually see straight through to the desktop, rather than the forms background image.

I have some LaVolpe source code but it’s for PNGs in ImageBoxes, which is fine because it works. And I only need 4 ImageBoxes for clothes, beards and hairs and accessories. I would have preferred to draw them, but it’s only for character creation so it’s not a huge issue.

I could easily just have a black picture box, and draw them onto it, but I’m stubborn and I want my character creation interface to look good, without black squares and shit.

alt text

Log in to reply