This repository has been archived on 2022-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
bookmark-manager/RyzStudio/Windows/ThemedForms/ThreadHelper.cs

52 lines
1.2 KiB
C#
Raw Normal View History

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;
}
}
}
}