0

I want to customize a textBox in C# and I have a problem. If I set

 textBox1.BackColor = Color.Transparent 

I receive error:

Additional information: Control does not support transparent background colors.

I tried to insert in constructor

SetStyle(ControlStyles.SupportsTransparentBackColor, true); 

but didn't solve anything. I have installed Dev Express but I don't know if it helps. Some ideas? Constructor:

public Constructor()
        {
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            InitializeComponent();
        }
dpaul1994
  • 332
  • 3
  • 16

1 Answers1

0

Is this a duplicate question??

Why am I getting "Control does not support transparent background colors"?

I don't think that winforms support transparent background colors.

Community
  • 1
  • 1
Frank
  • 47
  • 10
  • What exactly are you trying to achieve? What's the purpose of a transparent textbox control?? – Frank Mar 16 '15 at 11:51
  • just for design. I want it with border and with no background color – dpaul1994 Mar 16 '15 at 11:52
  • _There has to be an solution_ Why do you think so? Maybe there isn't! - You could write one all from scratch but the `TextBox` is a rather unfriendly beast that doesn't lend itself well to re-styling.. – TaW Mar 16 '15 at 11:54
  • I understand you want it. Why do you want it? Is there something you want to show in the textbox? Do you want the user to be able to see the text or an image behind it. You just want to force windows/UI/whatever to do something it won't do? I'm not trying to be nosy. I'm trying to understand your purpose. There's always more than one way to skin a cat. Question is why – Frank Mar 16 '15 at 11:55
  • I said that, because `Transparent` option is not there for nothing. It has a role. – dpaul1994 Mar 16 '15 at 11:56
  • Aaa I see. Well in that textBox, user will insert his username for login in program. – dpaul1994 Mar 16 '15 at 11:57
  • No, it may well be there as a leftover from the base class that has no function in TextBox! – TaW Mar 16 '15 at 11:57