本文介绍了如何在文本框中插入按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我需要在文本框中插入一个按钮,但是很遗憾,文本上方的按钮是这样,所以我无法读取该按钮后面的字符.任何想法,这是我的代码

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

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;
            }
        }
    }
}

推荐答案



这篇关于如何在文本框中插入按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 16:30
查看更多