CustomTextBox

J

Jay Dee

I have been looking for a way to make an auto size text box for a
project that I am working on.

In the end I have up on the TextBox/RitchTextBox classes as they
wouldn’t do what I wanted them to do.

The basic requirements that I was looking for is the text box are as
follows:
1. A fixed width but the height will resize depending on the text.
2. All text will be in the same Font size but I would like to be able
to set the fore/back colour of selected text.
3. Access to the location of characters so that I can custom paint to
highlight spelling mistakes.

To try and achieve these goals I have designed a CustomTextBox that
derives from Control. I am quite happy with my achievements and have
learned a lot.

I was wondering if someone would have the time to take a look and see
if they can point out how to speed things up little. It works
brilliantly with only a few lines of text but once the page gets a bit
bigger things start getting sluggish.

I now that it doesn’t wrap a whole word at the moment, I can sort
that.

Another big problem is that when typing text into one of the text
boxes the TableLayoputPanel is auto scrolling to the start of the
TextBox, this is no use if the text box is bigger than the form
because it scrolls the cursor out of view, I carnet work out how to
stop it. It is not my CustomTextBox because it also douse it if I use
a normal TextBox. Any suggestions.

Below is a link to the source code and a small example of what it will
do so fare.

www.jdnd.co.uk/bin/CustomTextBox.rar

Thank you

Jay Dee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top