0

テキストを右揃えにして、テキストを最後から表示したいと思います。例: textEdit1 の内容が "C:\Users\xxx.xxx\Documents\xxx\CODE\test\inner test\another\another\filename.sdfx" であるとします。

テキスト編集でテキスト全体が表示されない場合は、最後からテキストを表示して、ファイル名が常に表示されるようにします。

テキストを右揃えにする方法は知っていますが、2 番目の部分についてはわかりません。どんな助けでも大歓迎です。ここに画像の説明を入力

上の画像では、ファイルパスが長すぎて完全に表示できないため、ファイル名が常に表示されるようにパスを最後から表示したいと思います。私が自分自身を明確にしたことを願っています。

Windows 用の Devexpress 11.2 を使用しています。

4

2 に答える 2

0

上記のように SelectionStart に関係する解決策を見つけましたが、TextEdit が完全にロードされた後に実行する必要があります。

protected override void OnShown(EventArgs e)
{
    base.OnShown(e);

    textEdit1.Text = @"C:\Users\xxx.xxx\Documents\xxx\CODE\test\inner test\another\another\filename.xxx";
    textEdit1.SelectionStart = textEdit1.Text.Length;
}

Devexpress に感謝します。

于 2014-01-28T10:01:39.160 に答える
0

I think the caret position in the editor can be set using the SelectionStart and SelectionLength properties. After that, all you have to do is to implement both GotFocus and LostFocus events so that even when there is no focus, the end of the text is shown.

More details here.

于 2014-01-27T15:36:32.190 に答える