I would say to override the OnPaint method. It just seems cleaner, when
thinking about other controls subclassing your control, as well as the fact
that you get your work in before any event fires.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have been wondering this for some time. If I create my own class
> inherited from an existing class or create a user control, should I be
> overriding the OnFontChanged method (or similar) or capturing the
> FontChanged event. It seems they both get the same accomplished - so
> what is the difference between the two? Which should I be using?
> For example, lets say I create a class MyButton which inherits
> System.Windows.Forms.Button. Which should I use...
>
> Protected Overrides Sub OnPaint(ByVal e As
> System.Windows.Forms.PaintEventArgs)
>
> ' my code here
>
> MyBase.OnPaint(e)
> End Sub
>
> ---OR---
>
> Private Sub Me_Paint(ByVal sender As Object, ByVal e As
> System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
> ' my code here
>
> End Sub
>