Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I need to insert a button into a text box, but sadly the button above the text, so I can't read the characters behind the button. any ideas, here's my code

CSS
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Test.COM
{
    public class TextBox2 : TextBox
    {
        private Button _DeleteButton;
        private const int BUTTON_WIDTH = 16;

        public TextBox2()
        {
            _DeleteButton = new Button();
            _DeleteButton.Text = "X";
            this._DeleteButton.Width = BUTTON_WIDTH;
            _DeleteButton.Dock = DockStyle.Right;
            this.Controls.Add(_DeleteButton);
        }

        public bool DeleteButtonVisible
        {
            get
            {
                return _DeleteButton.Visible;
            }
            set
            {
                _DeleteButton.Visible = value;
            }
        }
    }
}
Posted
Updated 26-May-10 19:53pm
v2

You can try making the button semi-transparent by setting the Opacity.

Or

Create a composite control usin a container control like Panel and add textbox on the left and button on the right.
 
Share this answer
 
v2
See this thread.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900