numerictextbox.cs

来自「Fireball.CodeEditor is an source code ed」· CS 代码 · 共 46 行

CS
46
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace Fireball.Windows.Forms
{
    public class NumericTextBox:TextBox
    {
        private const int WM_PASTE = 0x302;
        private NumericBox _owner;

        internal NumericTextBox(NumericBox owner)
        {
            _owner = owner;
        }

        protected override void WndProc(ref Message m)
        {

            if (m.Msg == WM_PASTE)
            {
                string clipBoard = (string)Clipboard.GetData(System.Windows.Forms.DataFormats.Text);
                clipBoard = _owner.ParseInputString(clipBoard);
                if (this.SelectedText.Length > 0)
                {
                    this.SelectedText = clipBoard;
                }
                else
                {
                    this.AppendText(clipBoard);
                }

                return;
            }

            base.WndProc(ref m);
        }

        protected override void OnTextChanged(EventArgs e)
        {
            base.OnTextChanged(e);
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?