TextBox文字和光标放置在适当位置 [英] TextBox Text and cursor to place at position
问题描述
我使用两个文本框创建了一个自定义水印控件.
一个文本框用于水印,另一个文本框用于输入文本.
我想将文本放在水印文本框(第一个文本框)中的位置2
类似于Microsoft开发人员登录中的 密码框.
请帮忙.
I have created a custom watermark control using two textbox.
One textbox is for watermark and the other is to enter text.
I want to place the text in watermark textbox(first textbox) at position 2
and also I want to place the caret in the second textbox at position 2 and from position 2 I should be entering the text and not from position 0.
similar to the password box in microsoft developer sign in.
Please help.
推荐答案
您实际上是想将所有内容都偏移2吗?还是只想缩进文本?要缩进文本,请设置Padding属性:
Did you actually want to do everything offset by 2, or did you just want to indent the text? To indent the text, set the Padding property:
< TextBox Text ="abc"填充="20,2,2,2"/>
<TextBox Text="abc" Padding="20,2,2,2"/>
这篇关于TextBox文字和光标放置在适当位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!