[英]TextBox RTL with letters and numbers
我將TextBox.RightToLeft
屬性設置為Yes
。
當我輸入以下文本時:“ a 32”,存儲的字符串為“ 32 a”。 輸入文本的順序是:首先3 2然后是空格 ,然后是 。
如何保存輸入的值?
如果在運行時更改RightToLeft屬性的值,則僅保留未格式化的原始文本。
您將不得不自己顛倒其順序:
string[] text = textBox1.Text.Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries); //get string while preserving the words
Array.Reverse(text); //reverse the order of words (not their chars)
string finalValue = string.Join(" ", text); //make the string out of array
嘗試這個:
設置您的TextBox屬性RightToLeft = NO並使用TextAlign = Right。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.