Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pad cursor position in a text box in vb.net

Status
Not open for further replies.

geneo300zx

Programmer
Jul 10, 2003
3
US
Pad cursor position in a text box in vb.net
I want to be able to pad the cursor in a text box so the cursor is not all the way to the left. I want to be able to specify the size of the padding. I have been looking all over the place and could not find anything to do this. For example. Below is a text box with the cursor all the way to the left. The second dash represents the cursor.
______________
||_____________|

What I want to do is pad the cursors so it is not all the way to the left. Kind of like this: The second dash represents the cursor

_______________
|___|__________|

Any help would be appreciated. Thanks.
 
The easiest way I can think of it to put a TextBox into a UserControl, offset to the right. Make the UserControl back colour the same as the text box and set the text box border to none and the user control border to single.

As the text box is the only control in the user control, selecting the user control will move focus to the text box, but the cursor will appear to be padded as the text box is offset.

Obviously you'll need to pass the Text value through to the text box, and also some code to allow the padding value to be changed which will adjust the position of the text box, but you get the idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top