TextBox文字和光标放置在适当位置 [英] TextBox Text and cursor to place at position

查看:70
本文介绍了TextBox文字和光标放置在适当位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用两个文本框创建了一个自定义水印控件.
一个文本框用于水印,另一个文本框用于输入文本.

我想将文本放在水印文本框(第一个文本框)中的位置2 并且我也想将插入符号放置在第二个文本框中的位置2处,并且应该从位置2输入文本,而不是从位置0开始.

类似于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆