O
othell m. via .NET 247
Recently I wanted to create a small little program that could siton the desktop and not block the desktop wallpaper. There aretwo methods to accomplish this ( that I am aware of ).
1) create a solid color bmp as a background image and set thetransparency key to match its color
2) specify the form's background color with a matchingtransparency key
Now my issues with both methods, but first it should be knownthat I have set the forms to have no border or title bar andhave implemented code that allows me to click-and-hold anywhere( with exceptions listed below ) on the form and move it. Thedata actually displayed on the form is just text and onerectangle, all drawn by me ( there are no controls on the formitself ).
1) I have two issues with this method, although it is what I'mprefering to use at the moment. The first seems to be thediscrepancy between how the program is handled when thecomputer's Color Depth is 32bit or when it is less than 32bit (16bit ). When the color depth is 32bit then I am able to clickon the entire area the form inhabits ( even that which istransparent ) and move it, but if the color depth is less than32bit ( 16bit ) then only the drawn text or rectangle outline (since it has no fill ) can be clicked to drag the programaround. Clicking on the transparent areas just passes the clickthrough the form to whatever is below ( even when I know theform has focus ). I'd like to be able, regardless of thedesktop's color depth, to click anywhere within the form areaand move the application.
The second issue I have with this method occurs when I take myexecutable and put it on another PC ( my PC is XP Pro, the otherPC is XP Home.. Both SP2 ). The problem is similar, but alittle different. When the 2nd PC's color depth is at 32bit,the transparency does not work. The green/lime ( that's thetransparent color I'm using ) background shows. Needless to saythis is not acceptable. When I change the color depth to lessthan 32bit ( 24bit this time ), the transparency actually works,but I come across the same issue of clicks on the transparentareas just passing through.
2) With this method I have not tried it on a 2nd PC yet ( I don'thave it available where I am atm ). Its basically the same"issue" as mentioned above with color depth less than 32bit,except it does it with a color depth of 32bit and 16bit. Clickson the transparent areas just pass right through. I'm temptedto just go with this method and possibly make one area on theform that is meant to be used to drag it around ( similar to theidea of the box that appears to move tables in MS Word ), butI'm hoping there's a solution I'm unaware of before I do that.
Anyways, all of this brings up some interesting questions.
-What does color depth have to do with transparency handling?
-Does the version of XP ( Home or Pro ) handle transparencydifferently?
Probably some more questions also.
Not sure if it matters, but I'm doing all of this in C#.
So any ideas to get pass any of these issues?
Thanks in advance.
1) create a solid color bmp as a background image and set thetransparency key to match its color
2) specify the form's background color with a matchingtransparency key
Now my issues with both methods, but first it should be knownthat I have set the forms to have no border or title bar andhave implemented code that allows me to click-and-hold anywhere( with exceptions listed below ) on the form and move it. Thedata actually displayed on the form is just text and onerectangle, all drawn by me ( there are no controls on the formitself ).
1) I have two issues with this method, although it is what I'mprefering to use at the moment. The first seems to be thediscrepancy between how the program is handled when thecomputer's Color Depth is 32bit or when it is less than 32bit (16bit ). When the color depth is 32bit then I am able to clickon the entire area the form inhabits ( even that which istransparent ) and move it, but if the color depth is less than32bit ( 16bit ) then only the drawn text or rectangle outline (since it has no fill ) can be clicked to drag the programaround. Clicking on the transparent areas just passes the clickthrough the form to whatever is below ( even when I know theform has focus ). I'd like to be able, regardless of thedesktop's color depth, to click anywhere within the form areaand move the application.
The second issue I have with this method occurs when I take myexecutable and put it on another PC ( my PC is XP Pro, the otherPC is XP Home.. Both SP2 ). The problem is similar, but alittle different. When the 2nd PC's color depth is at 32bit,the transparency does not work. The green/lime ( that's thetransparent color I'm using ) background shows. Needless to saythis is not acceptable. When I change the color depth to lessthan 32bit ( 24bit this time ), the transparency actually works,but I come across the same issue of clicks on the transparentareas just passing through.
2) With this method I have not tried it on a 2nd PC yet ( I don'thave it available where I am atm ). Its basically the same"issue" as mentioned above with color depth less than 32bit,except it does it with a color depth of 32bit and 16bit. Clickson the transparent areas just pass right through. I'm temptedto just go with this method and possibly make one area on theform that is meant to be used to drag it around ( similar to theidea of the box that appears to move tables in MS Word ), butI'm hoping there's a solution I'm unaware of before I do that.
Anyways, all of this brings up some interesting questions.
-What does color depth have to do with transparency handling?
-Does the version of XP ( Home or Pro ) handle transparencydifferently?
Probably some more questions also.
Not sure if it matters, but I'm doing all of this in C#.
So any ideas to get pass any of these issues?
Thanks in advance.