| | |
opacity control...?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
HI,
i'm working on c#.net 2008 edition and i want if we can control the opacity of a picture box on the form differently from the form itself i.e. if we can make the form transparent while still be able to see the picture box on it fully visible.
i did try several things but all i could manage was this...
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
this.BackColor = Color.FromArgb(0,Color.Black);
but it won't work good. Any help?
i'm working on c#.net 2008 edition and i want if we can control the opacity of a picture box on the form differently from the form itself i.e. if we can make the form transparent while still be able to see the picture box on it fully visible.
i did try several things but all i could manage was this...
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.Opaque, true);
this.BackColor = Color.FromArgb(0,Color.Black);
but it won't work good. Any help?
# Never say impossible 'cause impossible itself says:
"I M POSSIBLE":) :) :)
#Your I Can is more important than your I.Q.
"I M POSSIBLE":) :) :)
#Your I Can is more important than your I.Q.
•
•
Join Date: Jun 2008
Posts: 58
Reputation:
Solved Threads: 9
Unfortunately there is no way to make a Form semi-transparent and keep controls within it opaque (as far as I know).
The hackery way to do it is to have two forms, one semi-transparent, and the other one on top to hold the opaque controls. However I don't recommend this since it is really messy.
The hackery way to do it is to have two forms, one semi-transparent, and the other one on top to hold the opaque controls. However I don't recommend this since it is really messy.
Visual C# Kicks - Free C# code resources and articles.
•
•
Join Date: Jul 2009
Posts: 1
Reputation:
Solved Threads: 0
There is a third party control library called SemitranparentForm.dll (StForm). By referring this assembly and inheriting the StForm we can get Opaque controls on Semitransparent form. A demo application is available. Use the below link for more information.
http://www.stforms.net
http://www.stforms.net
I don't think the OP was looking for a link to a product. But its a neat product I will admit. There are very few ways this can be done, you can custom draw your controls to the screen, which is complicated and can get very messy, but since its not drawn on the form. It can be whatever Opacity you want.
here's where the multiple forms concept comes to play. its not really that messy. its not that hard to do, It often yields great results. And using a "Form" overlay for your main form can get the job done.
it doesn't actually have to be a "Form" but just a separate "window" windows OS treats everything as a window, you just need to create another window, with its own handle, that can be modified separately. and the easiest way to do this is with a new form.
so. I suggest 2 methodologies for this.
1. if you don't intend to need to reuse, or use multiple controls with this feature, then just create a new form, with a formborderstyle of none, add the control you need on it. give it a transparent background. and create a public property that exposes the control.
Then in your original form, create an instance of the new form, set it where it needs to be, just as if it were just a control, then use and set the properties and methods of the control property you created just as if it were a normal control. and there you get the desired effect.
2. now if you want re-usability. then you can actually create a control that can be dropped onto a form. with a property of standard control types, that will automatically create the new form, set its position, and expose its control the way you want it. It wouldn't be that hard. and would be actually quite useful.
The hardest part, would be getting good transparency from the top controls. you would need them to all be custom controls that support transparent backgrounds. Exept the picturebox control, that would be easy because its a rectangle, so have it fill the control form, and adjust the control form's opacity. and you are golden.
I have a killer headache right now, and a ton of stuff to do for independence day, so I can't mock you up anything right now. but if you are still having trouble after the weekend. I can devote some time into showing what could be done in terms of this.
good luck and happy coding
here's where the multiple forms concept comes to play. its not really that messy. its not that hard to do, It often yields great results. And using a "Form" overlay for your main form can get the job done.
it doesn't actually have to be a "Form" but just a separate "window" windows OS treats everything as a window, you just need to create another window, with its own handle, that can be modified separately. and the easiest way to do this is with a new form.
so. I suggest 2 methodologies for this.
1. if you don't intend to need to reuse, or use multiple controls with this feature, then just create a new form, with a formborderstyle of none, add the control you need on it. give it a transparent background. and create a public property that exposes the control.
Then in your original form, create an instance of the new form, set it where it needs to be, just as if it were just a control, then use and set the properties and methods of the control property you created just as if it were a normal control. and there you get the desired effect.
2. now if you want re-usability. then you can actually create a control that can be dropped onto a form. with a property of standard control types, that will automatically create the new form, set its position, and expose its control the way you want it. It wouldn't be that hard. and would be actually quite useful.
The hardest part, would be getting good transparency from the top controls. you would need them to all be custom controls that support transparent backgrounds. Exept the picturebox control, that would be easy because its a rectangle, so have it fill the control form, and adjust the control form's opacity. and you are golden.
I have a killer headache right now, and a ton of stuff to do for independence day, so I can't mock you up anything right now. but if you are still having trouble after the weekend. I can devote some time into showing what could be done in terms of this.
good luck and happy coding
![]() |
Similar Threads
- Hidden Link - Please help. (PHP)
- transparancy on a control in C# (C#)
- Please check my code below (Java)
- how to add watermark in image (C#)
- Control Transparant Form (Visual Basic 4 / 5 / 6)
- Monitoring the mouse (Visual Basic 4 / 5 / 6)
- IPB vs. phpBB (Growing an Online Community)
Other Threads in the C# Forum
- Previous Thread: tooltip on mouse click
- Next Thread: Storing image to mysql in c#
| Thread Tools | Search this Thread |
.net access algorithm api array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ httpwebrequest image index input install java label libraries list listbox loop mandelbrot math mouseclick movingimage mysql mysql.data.client operator path photoshop php picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string study system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf xml





