Thanks
12 Answers, 1 is accepted
In .NET Windows Forms, the top-level windows do not support transparent colors. Since our ShapedForm is a top-level window (or simply a form), it does not support transparent colors as well.
However, you can set the TransparencyKey property to the value of the BackColor. This will make the background of ShapedForm transparent. You may also need to set the color of the border - it can be set to Transparent:
this
.TransparencyKey =
this
.BackColor;
this
.BorderColor = Color.Transparent;
If you have additional questions, feel free to contact me.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Could you please give us a sample project that show a transparent background ShapedForm? I have recently checked your tip by Telerik 2012 Q1 and VS 2010 but unfortunately it didn't work as well as is expected. I created a ShapedForm and set (this.TransparencyKey = this.BackColor) then put a PNG transparent image as the form's background image but the form's background didn't appear in transparent manner.
Your kindly help is very appreciated in advance.
Best Regards
Thank you for writing.
I am not quite sure what your image is, but if it has a color that is supposed to become transparent and this color is the same as the BackColor of the ShapedForm, both the ShapedForm and the color of the image should become transparent. I am attaching a sample project which covers this scenario. Note there, that one of the colors of the image is the same as the color of the ShapedForm and when this color is set as a TransparencyKey, the appropriate regions of the form become fully transparent.
I hope this helps.
Nikolay
the Telerik team
Actually, I want to create a Splash form with a partly transparent PNG image. How can I do this. my PNG image and a sample of desired Splash form are attached.
Thank you again
Regards
You should follow the approach that I demonstrated in the attached sample project. It seems that you want the white color to become transparent, so you should set the White color as a BackColor of the ShapedForm and you should also set the TransparencyKey to White.
Regards,Nikolay
the Telerik team
I changed backcolor = white and transparencykey = white but as you see in the new attachment it is not like the above JPG attachment.
I investigated your PNG image carefully and now I understand that it has a transparent color, but not a white color as I initially thought. So, you do not need to set white colors anywhere. Still, with or without setting a white color, I was not able to reproduce the issue that you have. I even tried the sample application with your image on WindowsXP (based on your desktop background image), but the image was transparent there as well as you can see in the screenshot attached to my response.
Please note that ShapedForm does not do anything special in the context of transparency and the issue should be a general case to the machine where you are trying my sample project. I would suggest that you try your scenario with the standard Microsoft Form and if you succeed in achieving transparency there, please write back so that we can apply the same approach to our ShapedForm.
Nikolay
the Telerik team
Did you create the form that is in opacity.png by telerik? If so, Actually, I need exactly something like that but i don't know how to set the Telerik's form's property to show transparent parts of image. Could you share us your last sample aplication that creates the form in the Opacity.png?
Regards
As I implied in my previous reply, the form that you see is the ShapedForm from my sample project with your image and there is nothing additional to it. Therefore, it seems like the issue where you do not get transparent colors is specific to your system and not to our suite. Once again, I would kindly ask you to try experimenting with the standard Microsoft Form which would act the same as ShapedForm. If you manage to achieve transparency with the standard form, you should have no issues to do the same with our ShapedForm.
For your reference, I am attaching my sample project with your image used in it. I hope this helps.
Nikolay
the Telerik team
Thank you again for your great help.
Now I can see the image as a transparent image. As I understood, when I set BackgroundImageLayout by values other than None or Tile or set DoubleBuffered by True then the transparent form will be appeared non-transparent.
Thank you for your appreciated help.
Regards
Thank you for sharing your findings with the community.
I am glad to heat that transparency is achieved on your side as well.
Nikolay
the Telerik team