Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2007

Tip: Looking for answers? Try searching our database.

Q: Overide OnPaint in textBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Arvidsson, Visual Systems AB - 10 May 2007 13:13 GMT
Hi!

I have a textBox on a windows form.

Can i overide the textbox OnPaint directly in the form, if so how.
Or do i have to inherit the textbox control and overide it there?

Regards
Martin
Moty Michaely - 10 May 2007 13:44 GMT
On May 10, 3:13 pm, "Martin Arvidsson, Visual Systems AB"
<martin.arvids...@vsab.net> wrote:
> Hi!
>
[quoted text clipped - 5 lines]
> Regards
> Martin

Martin,

There is no native .NET way to override the OnPaint besides inheriting
it that I know about.

You can subclass the textBox and override the WM_PAINT message using
interop services.

You can use inherit NativeWindow class and attach the window handle of
the TextBox to a it. The concrete class will override the WndProc
method and handle the WM_PAINT message in it.

Hope it helps.

Moty.
Martin Arvidsson, Visual Systems AB - 10 May 2007 15:28 GMT
Ok!

Thanx!

I think the easiest way to do it by inheritance. This way it's also easy to
maintain :)

/Martin

> On May 10, 3:13 pm, "Martin Arvidsson, Visual Systems AB"
> <martin.arvids...@vsab.net> wrote:
[quoted text clipped - 23 lines]
>
> Moty.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.