Changing TextBox left margin

  • Thread starter Thread starter Celio C Jr
  • Start date Start date
C

Celio C Jr

Hello,

How can I change the TextBox's left margin so I can create
an inherited class from TextBox and paint something on its
left side?

Thank you.

Celio C Jr
 
* "Celio C Jr said:
How can I change the TextBox's left margin so I can create
an inherited class from TextBox and paint something on its
left side?

P/invoke on 'SendMessage' + 'EM_SETMARGINS'.
 
It's great! Thanks a lot.

But now I have another problem. My new class is a numeric
textbox which have to allow the user to input signed
numbers. I am planning to enabled this feature by the
pressing of plus and minus keys (+ and -). When the user
hits the minus key, the negative sign appears at the left
side of the number; when he hits the plus key, no sign is
shown in the textbox.

This means that changing the left margin of the textbox is
not enough to make this feature work because the textbox's
default alignment is at the right side, and, in addition,
the textbox must allows the programmer to change the
text's alignment.

I do not want to include the negative sign character in
the text because of the lot of code I will have to write
in order to control user key hitting. I am thinking about
just painting the negative sign character at the left side
of the text, without including it in the text, by handling
some paint event.

I will glad to hear what you thing about that.

Celio C Jr
 
Back
Top