TextBox: Override which method to change border?

  • Thread starter Danyel Meyer - dialog-it GmbH
  • Start date
D

Danyel Meyer - dialog-it GmbH

Hey all...

I´m trying to find a solution to change the border of a TextBox-control,
e.g. the color etc. or let it completely disappear.
I´ve already tried to inherit a System.Windows.Forms.TextBox and to override
its OnPaint and OnPaintBackground methods, but that takes no effect.
Any suggestions what I might have to override? Which method paints the
border?

--
Danyel Meyer
-------------------------------------------
dialog-it GmbH
Röllinghäuser Strasse 55a
31061 Alfeld/Leine

Tel +49 (0) 5181 900 814
Fax +49 (0) 5181 900 815
E-Mail (e-mail address removed)
 
T

Tim Wilson [MVP]

You can always place the TextBox inside a Panel and then clip the border to
hide it by setting the TextBox size slightly greater than its parent
(Panel). And, if you want, you can then place that Panel inside another
Panel and leave a 1 pixel border and have whatever color you want based on
the BackColor. Did that all make sense?
 
D

Danyel Meyer - dialog-it GmbH

Thanks Tim,

That would surely be an alternative, but I´m looking for something more
"reusable", so creating my own control would do better in this case.

I still hope that someone has a hint where to look further.

Kind reguards,

--
Danyel Meyer
-------------------------------------------
dialog-it GmbH
Röllinghäuser Strasse 55a
31061 Alfeld/Leine

Tel +49 (0) 5181 900 814
Fax +49 (0) 5181 900 815
E-Mail (e-mail address removed)
 
T

Tim Wilson [MVP]

You can always create what I stated in the last post as a custom control so
that you can reuse it in other situations. If you're not sure about how to
create a custom control have a look at http://www.opennetcf.org/ and see the
source code for a few custom controls.
 

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