Transparent background

Stigi
02-15-2006, 07:56 AM
Hi there,

Im making a little desktop widget for myself using DX, its like a toolbar where I could put my favorite games, programs etc. The reason why I use DX is simply because GDI+ is slow when I want to make cool effects on hover and so on...

Now to the problem, I want to make everything behind my toolbar items transparent, the area I draw on simply covers the whole form, I'v yet not seen any examples on this, so I was wondering if its even possible? And If maybe someone know how to do this?

In advance, Thanks :D

ardman
02-16-2006, 04:21 AM
I understand the effect that you are looking for. They use it in Windows Vista. It's called Glass and is a big part of the new Aero desktop. You might be able to get the API for that on the net somewhere?

Have you tried creating your own ActiveX control which does this and add it to your form? So your control would have the minimize, maximise and close buttons so you can still keep control of the form that way.

Stigi
02-16-2006, 05:20 AM
I understand the effect that you are looking for. They use it in Windows Vista. It's called Glass and is a big part of the new Aero desktop. You might be able to get the API for that on the net somewhere?

Have you tried creating your own ActiveX control which does this and add it to your form? So your control would have the minimize, maximise and close buttons so you can still keep control of the form that way.

Thanks for the reply!

Your'e talking about the Minimize, Maximize and Close button on a form, am I correct?

Then you didn't quite understand what I meant, which means I asked in a stupid way, lets try again.

I have a form.
I draw on the whole form using DirectX.
What I draw is several pictues (items) used as shortcuts. (Like the OSX toolbar on the buttom).
The background (everything behind the pictures (items) I draw) should be transparent, so when I have this program on my desktop, all I see is the pictures (items) I can click on. And ofcourse then the desktop in the background...

If you still dont understand completely what I want I could make some screenshots.

Cheers

ardman
02-16-2006, 05:23 AM
So, what you are effectively doing is creating a fullscreen form with your own icons on it and then you want that form to be transparent to see the Windows desktop?

Stigi
02-16-2006, 06:13 AM
So, what you are effectively doing is creating a fullscreen form with your own icons on it and then you want that form to be transparent to see the Windows desktop?

Yes, that should be about right, but the form is a x width and x height, not fullscreen, but that doesn't matter.

ardman
02-16-2006, 07:08 AM
Not quite sure if thats possible to be honest, unless you had a clear background colour and the same colour was chosen as your transparency colour. When you have an image it will only be transparent for the colours that are the same in the picture.

I found this link: http://www.ur.co.nz/static/default_typeid_3_dataid_399.htm

Not sure if it will help but it is an irregular window.

Stigi
02-16-2006, 07:37 AM
Not quite sure if thats possible to be honest, unless you had a clear background colour and the same colour was chosen as your transparency colour. When you have an image it will only be transparent for the colours that are the same in the picture.

I found this link: http://www.ur.co.nz/static/default_typeid_3_dataid_399.htm

Not sure if it will help but it is an irregular window.

Making the form transparent is posible using the property on the form, but then its all flickery and disgusting, not a good solution.

So I hoped there was alphachannel and such implented in DX, which im 99% sure there is.

Also, I'm not sure the irregular window idea would work, but I will give it a try, just to see what happends.

Thanks alot, I'll edit when I have tested.

EDIT:
Okay, so I tested this and it sort of works, but its EXTREMELY slow, so this can't be used at all, too bad :mad:

Thanks for the effort anyway :D

ardman
02-16-2006, 07:39 AM
My understanding of the Alpha channel was that you picked a colour which you would use as a ColorKey and that would be the one which would become see-through. I may have the wrong end of the stick on this.

Stigi
02-16-2006, 07:55 AM
My understanding of the Alpha channel was that you picked a colour which you would use as a ColorKey and that would be the one which would become see-through. I may have the wrong end of the stick on this.

Thats exactly what I want, I want to pick a color, and make it transparent. within the DX drawarea.

ardman
02-16-2006, 08:00 AM
Ok, all you need to do then is change the renderstate to turn on Alphablending. Set the SourceBlend and the DestBlend colours. Once rendered, turn off alphablending.

Stigi
02-16-2006, 08:09 AM
Ok, all you need to do then is change the renderstate to turn on Alphablending. Set the SourceBlend and the DestBlend colours. Once rendered, turn off alphablending.

Ah ok, so I did this:


DXDevice.RenderState.AlphaBlendEnable = True
DXDevice.RenderState.SourceBlend = Blend.SourceAlpha
DXDevice.RenderState.DestinationBlend = Blend.InvSourceAlpha


But then I'm not sure what to do, how do I tell what colors etc?

ardman
02-16-2006, 08:33 AM
I done a quick search and I found this. I believe that this is what you are wanting to do.

Full credit to the author :-)

Stigi
02-16-2006, 08:42 AM
I done a quick search and I found this. I believe that this is what you are wanting to do.

Full credit to the author :-)

C#, :rolleyes:

I'll check it out, and edit if new problems occur, thanks again :)

Edit:
Yep, just as I thought, I cant convert this ;)
Have no clue whatsoever how to do this in VB.Net, or if it even works...this seems hopeless :huh:

ardman
02-17-2006, 08:34 AM
C#, :rolleyes:

I'll check it out, and edit if new problems occur, thanks again :)

Edit:
Yep, just as I thought, I cant convert this ;)
Have no clue whatsoever how to do this in VB.Net, or if it even works...this seems hopeless :huh:

I'll try and get round to converting it over the weekend. If not then I'll let you know a DX way of doing it.

ardman
02-17-2006, 08:43 AM
Just had another quick search on the net and stumbled across this page by Microsoft.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchShapedWindowsFormsControlsInVisualStudioNET.asp

This may help in what you are trying to do and it's in VB .NET and C# .NET.

Stigi
02-17-2006, 09:39 AM
Just had another quick search on the net and stumbled across this page by Microsoft.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchShapedWindowsFormsControlsInVisualStudioNET.asp

This may help in what you are trying to do and it's in VB .NET and C# .NET.

Thanks for still trying to help me, although it might seem hopeless ;)

The above link seems to be yet another way to do this, but yet again its not with DirectX, which I need.

cvb
05-06-2006, 10:29 AM
look i'll tell what i have :cool:

i use usually in VB 6.0 < --- i know very OLD :rolleyes:

* an API that makes ur frame a transparent by Alpha channel and it can be a click through one so when you click on a component u will fire the action MouseClick for that but if you clicked on the frame it self it will be clicked on the component behind i think it will be very usefull for you

* another way is to use CreateRect and setWindowRect which are very usefull but i'm workin on an ActiveX contol that you pass for it the Form and the Color so it will use the above API's to create a transparent for every pixel with that color

anywayz, just lamme know if that what u want coz i don't wanna put it here if u just wanna do it in DX :rolleyes:

cheers
CvB

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum