如何加载在MS Windows一个GTK夏普主题 [英] How to load a GTK Sharp theme on MS Windows

查看:183
本文介绍了如何加载在MS Windows一个GTK夏普主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编程使用Xamarin工作室5.4在MS Windows一个GTK夏普(V2.12)应用程序。安装的单声道版本是3.2.3(但我使用.net工具链进行编译,因为Xamarin不允许我使用单声道工具链编译)。

I'm programming a GTK Sharp (v2.12) application using Xamarin Studio 5.4 on MS Windows. The installed Mono version is 3.2.3 (but I'm using the .Net tool chain to compile, because Xamarin doesn't allow me to compile using the Mono toolchain).

的情况是,当我运行从Xamarin Studio或使用单声道的应用程序,那么我有一个比较漂亮的外观和放大器;感觉,但是当我运行使用的.Net应用程序(做双击可执行文件),然后是外观和放大器;感觉是可怕的。

The case is that when I run the application from the Xamarin Studio or using Mono, then I have a relatively nice look & feel, but when I run the application using .Net (doing double click on the executable) then the look & feel is horrible.

我试图欺骗应用程序加载一个体面的主题...但它什么都不做,当我从.net做的(但是当我使用单声道那么容易看到的变化)。

I've tried to trick the application to load a decent theme... but it does nothing when I do it from .Net (but when I'm using Mono then it's easy to see the changes).

这是在code我做过尝试,但不工作(我有GTK主题RC文件的本地副本):

This is the code I've tried but that does not work (I have a local copy of the GTK themes rc files):

// It works on Mono, but not on .Net
Gtk.Rc.Parse("Resources/GTK/windows-theme.gtkrc");

我也试着这样做:

I've also tried to do:

// This does not work at all (on MS Windows)
Gtk.Settings.Default.ThemeName = "MS-Windows";

但是,这并不即使使用单引擎改变什么。

But this does not change anything, even using the Mono engine.

这是怎样的应用程序看起来使用单声道:

This is how the application looks using Mono:

和它看起来如何在.NET发动机运转:

And how it looks running under the .Net engine:

感谢您的关注:)。

推荐答案

嗯,我已经找到了答案,我的问题。:D

Well, I've found the answer to my question :D .

我没有尝试加载特定的GTK主题,但解决它,使净正常工作,而不必所有的DLL文件拷贝在程序目录中。

I didn't try to load a specific GTK theme, but solved it to make .Net working properly without having to copy all the DLL files in the program directory.

我发现这个线程在Xamarin发展论坛:

I've found this thread in the Xamarin development forums:

在此线程Xamarin开发人员解释他们是如何解决的依赖装载问题。关键是要调用的 CheckWindowsGTK 方法之前在 Application.Init()通话。该CheckWindowsGTK在该文件中从MonoDevelop的来源定义的:

In this thread Xamarin developers explain how they solve the dependencies loading problem. The key is to call the CheckWindowsGTK method before the Application.Init() call. The CheckWindowsGTK is defined in this file from the Monodevelop sources:

  • <一个href="https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs#L359" rel="nofollow">https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs#L359

提示:仅当程序运行在Windows上调用CheckWindowsGTK重要的是

HINT: It's important to call CheckWindowsGTK only if the program is running on Windows.

这篇关于如何加载在MS Windows一个GTK夏普主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆