Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Thanks for any assistance provided and take care,

 

Hdokes

Posted

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?

Thanks for any assistance provided and take care,

 

Hdokes

  • *Experts*
Posted

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.

Posted

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)

"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

Posted

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?

Thanks for any assistance provided and take care,

 

Hdokes

  • *Experts*
Posted

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.

Posted

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?

Thanks for any assistance provided and take care,

 

Hdokes

Posted
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.

"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

Posted
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.
Posted
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.

Posted
That's the issue I have been having. Not being able to make the buttons transperent so underlying 'graphics' or images will show through.

Thanks for any assistance provided and take care,

 

Hdokes

Posted

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?

Thanks for any assistance provided and take care,

 

Hdokes

  • *Experts*
Posted
Thats probably happening becuase you set the TransparencyKey property of the form, it will make the specified color transparent on the whole form.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...