简体   繁体   English

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

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

Hi & thanks for looking! 嗨,谢谢您的光临!

How do I open default browser in fullscreen mode from a C# desktop application? 如何从C#桌面应用程序以全屏模式打开默认浏览器? I have seen similar questions on SO: 我在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#在FULLSCREEN浏览器窗口中打开本地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. 我不想混淆这个问题,但是我正在尝试Kinect语音识别引擎,它将在系统托盘中运行一个程序,始终在监听。 I already have it to a point that I can say a command and it will. 我已经说到了可以说一个命令的地步。 . .

//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 马特

For that you would need to use sendkeys 为此,您将需要使用sendkeys

Looking at the list you need something like: 查看列表,您需要以下内容:

ActiveForm.SendKeys("{F11}");

Hope that solves your issue. 希望能解决您的问题。

wouldn't the SendKeys need to be 不需要SendKeys是

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

instead of 代替

ActiveForm.SendKeys("{F11}");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM