在winforms中使用线程

时间:2017-08-22 13:57:28

标签: wpf multithreading winforms

如何在WinForms上做同样的事情,我在WPF应用程序中(Application.Current.Dispatcher.Invoke((Action)委托):

public class Fullscreen
    {
public Fullscreen(Action goFullScreen)
        {
            goFullScreenMode = goFullScreen;
        }
public void Make()
        {
Application.Current.Dispatcher.Invoke((Action)delegate
                {
                    goFullScreenMode();
                });
}
}

我需要访问WinForms中的MainWindow.cs,其中包括:

public void GoFullScreen()
        {
            TopMost = true;
            FormBorderStyle = FormBorderStyle.None;
            WindowState = FormWindowState.Maximized;
        }

我在MainWindow_Load中注册了这样的内容

_fullscreen = new Fullscreen(GoFullScreen);
RegisterJavaScriptObject("__fullscreen", _fullscreen);

0 个答案:

没有答案