Search Results

Search found 1 results on 1 pages for 'user181813'.

Page 1/1 | 1 

  • Neither Invalidate() nor Refresh() invokes OnPaint()

    - by user181813
    I'm trying to get from Line #1 to Line #2 in the below code: using System; using System.Windows.Forms; namespace MyNameSpace { internal class MyTextBox : System.Windows.Forms.TextBox { protected override void OnEnabledChanged(EventArgs e) { base.OnEnabledChanged(e); Invalidate(); // Line #1 - can get here Refresh(); } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); System.Diagnostics.Debugger.Break(); // Line #2 - can't get here } } } However, it seems that neiter Invalidate() nor Refresh() causes OnPaint(PaintEventArgs e) to be invoked. Two questions: Why doesn't it work? If it can't be fixed: I only want to invoke OnPaint(PaintEventArgs e) in order to access the e.Graphics object - is there any other way to do this?

    Read the article

1