Ubuntu 中的 Mono winforms 应用程序全屏?
只是想知道是否有一种已知的方法可以让 Mono System.Windows.Forms 应用程序在 Ubuntu/Gnome 上全屏显示。
单声道是 2.4.2.3 Ubuntu 是 9.10
在 Windows 上执行此操作需要 pinvoke,显然在这里不起作用。
这就是我将窗口边框设置为无、窗口位置设置为中心、状态设置为最大化的结果:
alt text http://dl.dropbox.com/u/116092/misc/permalink/joggler/screenshot01.png
更新。
也尝试过:
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;CTRL-F11
Text = string.Empty; // 无标题
最大化框 = false;
最小化框 = false;
控制框 = false;
FormBorderStyle = 无;
窗口状态=最大化;FormBorderStyle = FormBorderStyle.None;
位置 = 新点(0, 0);
大小 = Screen.PrimaryScreen.Bounds.Size;
所有这些我最终都得到相同的结果。
我遇到过一条涉及 _NET_WM_STATE_FULLSCREEN 的 pinvoke 的线索,但这就是我所掌握的。任何有关这方面的指示将不胜感激。
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 it on Windows requires a pinvoke, clearly not going to work here.
This is what I get setting window border to none, window position to centre, and state to maximised:
alt text http://dl.dropbox.com/u/116092/misc/permalink/joggler/screenshot01.png
Update.
Have also tried:
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;CTRL-F11
Text = string.Empty; // No caption
MaximizeBox = false;
MinimizeBox = false;
ControlBox = false;
FormBorderStyle = None;
WindowState = Maximized;FormBorderStyle = FormBorderStyle.None;
Location = new Point(0, 0);
Size = Screen.PrimaryScreen.Bounds.Size;
All of which I end up with the same result.
I have come across a lead which involves a pinvoke involving _NET_WM_STATE_FULLSCREEN but that's as far as I've got with it. Any pointers on that would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
_NET_WM_STATE_FULLSCREEN 将消除边框。 GNOME 面板仍然会出现。
根据以下帖子,秘诀是摆脱最小/最大尺寸,以便窗口管理器自行调整大小:
http://linux.derkeiler.com/Mailing-Lists/GNOME/2010-01/msg00035.html
以下是有关本机规范的一些文档:
http://standards.freedesktop.org/wm-spec/wm- spec-latest.html
http://www.x.org/docs /ICCCM/icccm.pdf
要直接与 X Window 系统对话,您必须 pinvoke 进入 XLib。为了发送类似 _NET_WM_STATE_FULLSCREEN 的内容,您必须有一个指向窗口和显示器的指针。
我不知道如何找到显示器,但我可以提供指向窗口的指针。当在 X 上运行时,属性
Form.Handle
应该是指向 X 窗口的指针。_NET_WM_STATE_FULLSCREEN will just get rid of the borders. The GNOME panel will still appear.
According to the following post, the secret is to get rid of the minimum/maximum sizes so that the window manager does the resizing itself:
http://linux.derkeiler.com/Mailing-Lists/GNOME/2010-01/msg00035.html
Here is some documentation on the native spec:
http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
http://www.x.org/docs/ICCCM/icccm.pdf
To talk directly to the X Window System you have to pinvoke into XLib. In order to send something like _NET_WM_STATE_FULLSCREEN you have to have a pointer to the window and also to the display.
I am not sure how to find the display but I can help with a pointer to the window. When running on X, the property
Form.Handle
should be a pointer to the X window.不确定“全屏”是什么意思 - 但我已经编写了几个接管屏幕的 Windows.Forms 应用程序,并且没有单个 PInvoke。
这是我配置主表单的方法...
(可选)
希望这有帮助。
Not sure what you mean by "Full Screen" - but I've written several Windows.Forms applications that take over the screen, and without a single PInvoke.
Here's how I configure my main form ...
Optionally,
Hope this helps.
您需要在 ubuntu 中禁用视觉效果。
编辑:
并确保您的表单大小至少为无边框的屏幕分辨率。如果边框在设计时并且您要在代码中删除它们,则您将需要 1030x796 之类的值来显示 1024x768。
You need to disable visual effects in ubuntu.
edit:
And make sure your form size is at least screen resolution without borders. If borders are on design time and you are removing them in code you will need something like 1030x796 for a 1024x768 display.
我被这个问题困扰了两天,终于找到了解决方案:
单击左侧工具栏上的第一个图标并搜索 compizconfig 程序。转到首选项-> unity,你会看到左侧有一个 Unity 插件的勾号。删除该勾号,您将看到顶部菜单栏消失。
虽然这个帖子很老了,但我仍然希望我可以帮助任何遇到这个问题并寻求帮助的人。
I have been suffered by this problem 2 days and finally i got the solution:
click the 1st icon on left tool bar and search compizconfig program. Go to preference-> unity and you will see there is a tick for unity plugin on the left side. Remove that tick and you will see the top menu bar disappeared.
Though this thread is very old but I still hope I can help anyone who gets this problem and seek for help.
你试过这个吗?
不幸的是,我现在没有可用的 Ubuntu,但我可以在旧的单声道版本中看到旧的补丁......
Have you tried this?
Unfortunately I have no Ubuntu available right now, but I can see old patches for this in old mono versions...
应该可以使用“CTRL+F11”热键以全屏模式显示 gnome 中运行的每个应用程序。
也许你可以尝试一下
,但这只是一个猜测,我还没有运行 atm 的 Linux 来尝试这个。但也许这有帮助。
It should be possible to display every app running inside gnome in fullscreen mode with the "CTRL+F11" hotkey.
Maybe you could try
but that is just a guess, I haven't got a Linux running atm to try this. But maybe this helps.
我现在无法测试它,但是你尝试过简单的调整大小吗?
I can't test it at the moment, but have you tried a simple resize?
我现在已经通过设置面板的自动隐藏属性解决了这个问题。
并不理想,因为这取决于用户更改环境来使用我的应用程序,但总比没有好。
I have worked around this for now by setting the autohide property of the panel.
Not ideal because it depends on the user changing their environment to use my application, but better than nothing.
YMMV。 http://fixunix.com/xwindows/ 91585-how-make-xlib-based-window-full-screen.html
YMMV. http://fixunix.com/xwindows/91585-how-make-xlib-based-window-full-screen.html
以下工作有效:(
灵感来自这里:https://bugzilla.xamarin.com /show_bug.cgi?id=40997)
1) sudo apt-get install wmctrl
2) 在您的代码中:
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: