i'm tring to make a diary.

i need nice background.
user could edit text anytime if he/she wants.

but i cant do that, because i cant make transparent background on textbox or i cant make editable label.

is there any way to do transparent background on textbox?
how can i make editable label?
or what should i do?

thanks for your helps.

There is a way to enable Transparent color in a control but it has to be done in the Constructor (New). You don't have access to the constructor for the built in controls but you can subclass any control and add

Me.SetStyle(ControlStyles.SupportsTransparentBackColor,True)

to the constructor for that control. However, I gave this a try and still ended up with a non-transparent control. Either I did it incorrectly (thank you Microsoft for not providing an example) or the info I read was incorrect (thank you again Microsoft). If anyone has a further suggestion I'd be interested to know where (or if) I went wrong.

The above code appears to work, but you also have to set the control's background to transparent. The code Jim provided tells the form that there are controls on the form have a color of Transparent set. As far as an Editable Label, you can use a text box that is read-only (ReadOnly=True), and when the user double-clickes it, for example, makes the text box writtable (ReadOnly = False)

Edited 4 Years Ago by Maligui

I did set the background of the textbox to transparent. Didn't help. As far as the SetStyle call is concerned, it is applied to the control (textbox), not the form. All it really appears to do is enable setting the BG color of the textbox to Color.Transparent without generating an error. Other than that, there doesn't appear to be any effect.

umm...
Okay, i shouldnt use always custom controls. Alphablendtextbox control didnt work. I should use setstyle, but i really dont know what is constructor. Where should i use this code. Could you explain little more.

I don't think it would help. I tried to get the SetStyle version implemented and it didn't behave as documented. I believe I did everything right but the background wasn't made transpoarent.

In a nutshell, what you do is subclass TextBox (make a custom control that inherits TextBox), then in the New method for the custom control you use SetStyle to enable the custom control to have a transparent background with SetStyle. It didn't work.

This question has already been answered. Start a new discussion instead.