Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/10 04:33:20 (14 years ago)
Author:
mkommend
Message:

fixed cross threading issues in ViewHost (ticket #972)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ControlExtensions.cs

    r3177 r3398  
    3232
    3333    public static void SuspendRepaint(this Control control) {
    34       SendMessage(control.Handle, WM_SETREDRAW, false, 0);
     34      if (control.InvokeRequired)
     35        control.Invoke((Action<Control>)((c) => { c.SuspendRepaint(); }));
     36      else
     37        SendMessage(control.Handle, WM_SETREDRAW, false, 0);
    3538    }
    3639    public static void ResumeRepaint(this Control control, bool refresh) {
    37       SendMessage(control.Handle, WM_SETREDRAW, true, 0);
    38       if (refresh) control.Refresh();
     40      if (control.InvokeRequired)
     41        control.Invoke((Action<Control, bool>)((c, b) => { c.ResumeRepaint(b); }));
     42      else {
     43        SendMessage(control.Handle, WM_SETREDRAW, true, 0);
     44        if (refresh) control.Refresh();
     45      }
    3946    }
    4047  }
Note: See TracChangeset for help on using the changeset viewer.