Windows Develop Bookmark and Share   
 index > Windows Forms General > Stretch And Opacity
 

Stretch And Opacity

I have two questions:

I'm deeply confused as to how Windows Forms handles opacity. I have a picture box containing an opaque image, and three more on top of it. Their BackColor properties are all set to Transparent, and they are all primarily transparent. Unfortunately, the transparent areas all appear white, instead of displaying the image beneath them. Does anyone have any information on this?

My second question is also regarding PictureBox Controls. I have another PictureBox that needs to stretch the length of a window, but when this length is greater than that of the image, it doesn't stretch properly. Instead, the bottom half is a gradient to white. (I have the SizeMode property set to StretchImage.)

Any help is greatly is greatly appreciated.
AFLood  Saturday, April 28, 2007 4:35 PM
your "Opaque Image" might contain white areas rather than transparent areas. Just to make sure, the image that you load into the picturebox should be either png or gif (coz they support transparency). If the image is a bmp, it cannot have transparent areas.

for ur second question, ill tell u a much simpler way of doing it. do try it out ... itll work fine
reset all properties of the picbox to default. sizemode to normal. set the backgroundcolor as transparent. then select the "backgroundimage" as the image you want to display. Next, select the backgroundimagelayout to strech. thats it. now strech the picbox and ull have resized transparent image.
Abhishek_Kumar_9a02d4  Sunday, April 29, 2007 6:20 AM
Thanks. I was using png, but I decided rather that figure out what the problem was, I'd just merge the images. I have a few more files than before, but at least its working.

As for the second problem, that fixed it too. Thanks a lot.

EDIT: But wait... I still have one more problem. I have another image containing transparency, (I went back to the editor to check that its actually transparent and not white) and this transparent section is supposed to show the area beneath the window. I can't set the window backcolor to Transparent, and changing the opacity affects child controls too. how can I make the window transparent, but keep its child controls opaque?
AFLood  Sunday, April 29, 2007 3:23 PM

You can use google to search for other answers

Custom Search

More Threads

• html editor control not compatible with xhtml
• Form always on top
• Custom control, custom DataGridViewColumn and Cell - horrible flicker.
• Mouse scroll event
• Strange and Annoying Autoscroll Bug??
• VB6 COM object not show correctly when form is mdichild
• A Couple Of things
• Mail receiving
• Sharing a settings file between assemblies
• Redirecting Console Output