HDokes Posted July 10, 2003 Posted July 10, 2003 I am wanting to set a series of buttons as transparent so that the back ground image of the form shows through. I have gone to the properties of the button and made the foreground and background colors transparent and removed all images from the button... however... it wants to maintain a 'grey' color and does not allow the underlying colors to 'bleed' through. Is this possible or not? Quote Thanks for any assistance provided and take care, Hdokes
mattscotney Posted July 11, 2003 Posted July 11, 2003 Hi, Try changing the Backcolor of the button in the properties window to 0. Quote
HDokes Posted July 12, 2003 Author Posted July 12, 2003 I attempted the changing of both the background and the forground colors to 0 in addition to trying the 'transparent' setting.... in both cases.... I could not see anything behind the button... ergo.... it wasn't transparent. Seems a bit goofy to me for VB to offer 'transparent' as a 'color' item and then not be able to actually see through the object on the form. Any one have any other ideas or is this just not possible? Quote Thanks for any assistance provided and take care, Hdokes
*Experts* mutant Posted July 12, 2003 *Experts* Posted July 12, 2003 Setting buttons transparent is working all right for me. Works both from code or setting it from Properties window. Button1.BackColor = Color.Transparent And going to BackColor, Web, then Transparent in Properties works. Quote
ballisticnylon Posted July 12, 2003 Posted July 12, 2003 Works for me, too. And if you want to set the degree of transparency, you could do something like: Dim alpha As Int16 ' <--- number between 0 (totally transparent) and 255 (totally opaque) alpha = 60 Button1.BackColor = Color.FromARGB(alpha, SystemColors.Control) Quote "It may be roundly asserted that human ingenuity cannot concoct a cipher which human ingenuity cannot resolve." - Edgar Allan Poe, 1841 I long to accomplish great and noble tasks, but it is my chief duty to accomplish humble tasks as though they were great and noble. The world is moved along, not only by the mighty shoves of its heroes, but also by the aggregate of the tiny pushes of each honest worker. - Helen Keller
HDokes Posted July 13, 2003 Author Posted July 13, 2003 Well now this is silly.... I have done it through the properties window the whole time.... and still can not get the button to go transperent.... it always wants to assume this battleship gray color.... Actually... what I am finding out here is it is defaulting to the back ground color of the form. If I change the form's color.... the button assumes it.... if I move the button over another object that has it's own color.... and keep the transparent button to the front.... it blocks the underlying object with the color of the form background. Next test..... placed the following in a button control click routine who's original background color is light purple. In run time, when I click on the button.... again... tha back ground color is adopted for the button.... not a transparent color... and the button overlaps another control which is now blocked where the overlap occurs.... code: alpha = 0 btnLightPurple.BackColor = Color.FromArgb(alpha, SystemColors.Control) Is there another color setting (default) that I may be overlooking? Quote Thanks for any assistance provided and take care, Hdokes
*Experts* jfackler Posted July 13, 2003 *Experts* Posted July 13, 2003 No, you're not overlooking anything. From the ms-help files: If the SupportsTransparentBackColor bit is set, and the BackColor is set to a color whose alpha component is less than 255, OnPaintBackground will simulate transparency by asking its parent control to paint the background. This is not true transparency. Note If there is another control between the control and its parent, the current control will not show the control in the middle. Quote
HDokes Posted July 15, 2003 Author Posted July 15, 2003 So what your saying jfackler is that my summations are correct? You mean I may have gotten something right here in this .NET world? Transparency in controls truely doesn't exist in a VB world? Quote Thanks for any assistance provided and take care, Hdokes
ballisticnylon Posted July 15, 2003 Posted July 15, 2003 So what your saying jfackler is that my summations are correct? You mean I may have gotten something right here in this .NET world? Transparency in controls truely doesn't exist in a VB world? We've all said that transparent buttons are possible, and easy, in vb.net. Clearly you've got a problem unrelated to the language (or world, if you will) you're writing in. Try running the code we've posted on another machine and see if it works. Quote "It may be roundly asserted that human ingenuity cannot concoct a cipher which human ingenuity cannot resolve." - Edgar Allan Poe, 1841 I long to accomplish great and noble tasks, but it is my chief duty to accomplish humble tasks as though they were great and noble. The world is moved along, not only by the mighty shoves of its heroes, but also by the aggregate of the tiny pushes of each honest worker. - Helen Keller
*Gurus* divil Posted July 15, 2003 *Gurus* Posted July 15, 2003 True transparency (and translucency) doesn't exist for child windows (buttons, user controls etc) in the win32 world. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
jace808 Posted July 15, 2003 Posted July 15, 2003 aarrrr... I can't get my buttons to go 'transparent' with any of these options. It tells me that it's not a valid property and defaults itself to grey. Quote
*Experts* jfackler Posted July 15, 2003 *Experts* Posted July 15, 2003 jace, Are you trying to make buttons specifically or another type of control transparent? Quote
jace808 Posted July 15, 2003 Posted July 15, 2003 jace, Are you trying to make buttons specifically or another type of control transparent? I'm toying with the idea of transparency in general. I've been able to make combo box transparent, but not my buttons. Quote
HDokes Posted July 16, 2003 Author Posted July 16, 2003 That's the issue I have been having. Not being able to make the buttons transperent so underlying 'graphics' or images will show through. Quote Thanks for any assistance provided and take care, Hdokes
HDokes Posted July 17, 2003 Author Posted July 17, 2003 OK... here's a twist to the transparency thingy..... I have inadvertantly found that I have somehow set a 'color' to be interpreted as a transparent color. I say this because anything I now make that color, shows no color in run time but rather the underlying screen color below the form itself. Even when it has objects behind it in the same form.... it 'sees' completely through the form. What gives? Quote Thanks for any assistance provided and take care, Hdokes
*Experts* mutant Posted July 17, 2003 *Experts* Posted July 17, 2003 Thats probably happening becuase you set the TransparencyKey property of the form, it will make the specified color transparent on the whole form. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.