using System.Drawing; using System.Windows.Forms; namespace RyzStudio.Windows.ThemedForms { public class ThreadHelper { public static void SetText(TextBox sender, string text) { if (sender.InvokeRequired) { sender.Invoke(new MethodInvoker(() => { sender.Text = text; })); } else { sender.Text = text; } } public static void SetText(MemoBox sender, string text) { if (sender.InvokeRequired) { sender.Invoke(new MethodInvoker(() => { sender.Text = text; })); } else { sender.Text = text; } } public static void SetImage(PictureBox sender, Image image) { if (sender.InvokeRequired) { sender.Invoke(new MethodInvoker(() => { sender.Image = image; })); } else { sender.Image = image; } } } }