windows 如何从 C# 桌面应用程序以全屏模式打开默认浏览器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8648768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:44:40  来源:igfitidea点击:

How do I open default browser in fullscreen mode from a C# desktop application?

c#.netwindowssendkeys

提问by Matt Cashatt

Hi & thanks for looking!

嗨,感谢您的关注!

How do I open default browser in fullscreen mode from a C# desktop application? I have seen similar questions on SO:

如何从 C# 桌面应用程序以全屏模式打开默认浏览器?我在 SO 上看到过类似的问题:

How to open in default browser in C#

C#如何在默认浏览器中打开

. . .BUT nothing addresses opening a local HTML file (C: drive) in a FULLSCREEN browser window from C#.

. . .BUT 没有解决在 C# 的全屏浏览器窗口中打开本地 HTML 文件(C:驱动器)的问题。

I can open the window using this:

我可以使用这个打开窗口:

Process.Start("http://google.com");

But how do I make it default to fullscreen? Is there a way to simulate the F11 key press, or even something more direct?

但是我如何使它默认为全屏?有没有办法模拟 F11 按键,甚至更直接的东西?

EDIT: Ideally, I will not need to have a form open. I don't want to confuse the issue, but I am experimenting with the Kinect Speech Recognition engine and will have a program running in the system tray, always listening. I already have it to a point that I can say a command and it will. . .

编辑:理想情况下,我不需要打开表单。我不想混淆这个问题,但我正在试验 Kinect 语音识别引擎,并将在系统托盘中运行一个程序,始终在监听。我已经有了它,我可以说一个命令,它会的。. .

//do stuff

. . .and in this case, I just want it to open the default browser in fullscreen mode.

. . .在这种情况下,我只希望它以全屏模式打开默认浏览器。

So, I don't have to be able to toggle back and forth between fullscreen and regular screen, just launch in fullscreen. I was thinking that a simulation of the F11 press would be the answer, but it sounds like I need a form open for this??

因此,我不必能够在全屏和常规屏幕之间来回切换,只需在全屏模式下启动即可。我在想 F11 印刷机的模拟将是答案,但听起来我需要为此打开一个表格??

Thanks!

谢谢!

Matt

马特

采纳答案by H Bellamy

For that you would need to use sendkeys

为此,您需要使用sendkeys

Looking at the list you need something like:

查看列表,您需要以下内容:

ActiveForm.SendKeys("{F11}");

ActiveForm.SendKeys("{F11}");

Hope that solves your issue.

希望能解决您的问题。

回答by MethodMan

wouldn't the SendKeys need to be

SendKeys 不需要是

ActiveForm.SendKeys.Send("{F11}"); 

instead of

代替

ActiveForm.SendKeys("{F11}");