Mono winforms app fullscreen in Ubuntu?

前端 未结 10 2320

Just wondering if there\'s a known way of getting a Mono System.Windows.Forms application to go fullscreen on Ubuntu/Gnome.

Mono is 2.4.2.3 Ubuntu is 9.10

Doing

10条回答
  •  一整个雨季
    2021-02-08 12:03

    The following worked:

    (Inspiration was taken from here: https://bugzilla.xamarin.com/show_bug.cgi?id=40997)

    1) sudo apt-get install wmctrl

    2) In your code:

    Form form = new MainWindow();
    form.FormBorderStyle = FormBorderStyle.None;
    form.WindowState = FormWindowState.Maximized;
    
    form.Load += (s, e) => {
        Process process = new Process {
            StartInfo = new ProcessStartInfo {
                FileName = "wmctrl",
                Arguments = $"-r :ACTIVE: -b add,fullscreen",
                CreateNoWindow = true
            }
        };
        process.Start();
        process.WaitForExit();
    };
    
    Application.Run(form);
    

提交回复
热议问题