从右到左在文本框中输入?

use*_*032 6 .net c# textbox maskedtextbox winforms

我有一个Textbox带面具的货币.面具显示textbox--------.--

因此用户在掩码上键入数字.

现在客户说他不想从左到右输入信件.他想从右到左打字.

类似于我们在计算器中的含义.

现在我尝试改变它textboxrighttoleft属性,但这对我的事业没有帮助.

最后,我坚持处理关键事件以手动更改位置.我能够改变位置,但是完成了逻辑.

这是我的代码的样子:

 void Textbx_KeyDown(object sender, KeyEventArgs e)
    {


        String temp = T.Text;
        string temp2 = T.Text;

        int CursorIndex = T.SelectionStart - 1;

        for (int i = 0; i <= CursorIndex; i++)
        {
            if (i == 7)
            {

                temp2 = temp2.Insert(i, temp[i + 2].ToString());
                temp2 = temp2.Remove(i, 2);

                //i = i + 2;
            }
            else if (CursorIndex == i)
            {
                temp2 = temp2.Remove(i, 1);
                temp2 = temp2.Insert(i, temp[i + 1].ToString());
            }

            else
            {
                //   T.Text = T.Text.Insert(i + 1, "_");

                temp2 = temp2.Insert(i, temp[i + 1].ToString());
                temp2 = temp2.Remove(i + 1, 1);

            }

        }
        T.Text = temp2;
        // T.Text = T.Text.Insert(CursorIndex-1, temp[CursorIndex].ToString());
        if (CursorIndex != -1)
            T.SelectionStart = CursorIndex - 1;


    }
Run Code Online (Sandbox Code Playgroud)

有一个更好的方法吗?如果不是我应该如何完成逻辑?

Sys*_*gon 4

文本框中有一个属性:

T.RightToLeft = RightToLeft.Yes
Run Code Online (Sandbox Code Playgroud)