1

I have this transparent textbox:

public partial class TransparentTextBox : TextBox
    {
        public TransparentTextBox()
        {
            InitializeComponent();

            SetStyle(ControlStyles.SupportsTransparentBackColor |
             ControlStyles.OptimizedDoubleBuffer |
             ControlStyles.AllPaintingInWmPaint |
             ControlStyles.ResizeRedraw |
             ControlStyles.UserPaint, true);

            BackColor = Color.FromArgb(70, Color.Black);
        }
    }

And when I try to type in it it appears a white block on it and I don't want this to happen..

J. Homer
  • 147
  • 1
  • 11
  • 1
    Inevitable. The TextBox control does *not* support transparency, so what you have is a hack. The hack breaks when you start to type, since the native control's painting logic kicks in and draws the textbox's normal background. There is no such thing as a "transparent textbox". – Cody Gray - on strike Dec 18 '16 at 11:36
  • You could also use third-party components or WPF for that... – Phil1970 Dec 18 '16 at 14:13
  • a) you really should not repost the very same question. b) let alone create new account for doing so!! c) if you can live with a reduced functionality you can write an EditingControl in under 200 lines. Getting Mouse interaction, selections, multilines, overwrite mode or a blinking caret right is painfully hard. But for a entry field these won't be needed.. – TaW Dec 18 '16 at 15:27
  • I couldn't add comments at the time... – J. Homer Dec 19 '16 at 19:31
  • 1
    You can always add comments to your own posts, and to any answers to your own question. So if you couldn't add comments, it's because you weren't logged in. (Or because you have two accounts that you need to ask a moderator to merge.) – Cody Gray - on strike Dec 20 '16 at 10:33

0 Answers0