0

I am placing a textbox within a textbox like this:

enter image description here

I have achieved the above with the following code:

        var innerTextBox = new TextBox();
        innerTextBox.Width = 100;

        var outerTextBox = new TextBox();
        outerTextBox.Multiline = true;
        outerTextBox.Height = 100;
        outerTextBox.Width = 200;

        outerTextBox.Controls.Add(innerTextBox);
  1. Now the problem is that the text goes behind the textbox, how can I prevent that?

  2. I would also like the textbox inside to behave as text so that one can delete it with backspace just like regular text.

Can somebody please point me to the right direction?

This is a winforms project.

Thanks a lot!

4

1 に答える 1

0

txt.BringToFront または txt.SendToBack を試しましたか?

あなたの質問から私が得ているのは、前のテキストボックスに透明性が必要だということです。ラベルを使ってみましたか?ラベルはデフォルトで透明で、テキスト ボックスのテキストが変更されたときに変更できます。

于 2013-10-08T17:49:48.853 に答える