[Gtk-sharp-list] Windows theme not applied

D. Dobrev dpldobrev at yahoo.com
Sun Nov 30 13:31:31 EST 2008

Thank you, Andy. Unfortunately your approach didn't work for me, but it
doesn't matter. I think there must be an universal way to do this (i.e.
without custom resource files). For example, the GIMP (it doesn't use GTK#,
but it does use GTK+) correctly find the Windows theme. Also VS applies the
theme somehow, and so do the GTK# demos installed with Mono for Windows,
which start through a terminal window. There must be a way to do this, I
just don't know it. And I want to learn it.

Andy Selvig wrote:
> It seems like this is an issue of Gtk using the default style instead of
> the
> Windows style when you run it outside of VS. You can force your app to use
> the Windows style by making a custom rc file and parsing it at runtime.
> I've
> had a similar problem before and used this method to get around it as the
> default theme is unacceptably archaic in a modern Windows environment.
> Using
> a custom rc file also allows you to tweek other default display settings
> like toolbar icon size. While some people believe the app should totally
> respect the user's decisions on these matters, I believe it's the
> perogative
> of the developer to express their own style.
> Anyway, just make your own rc file (I've attached the one I use for
> Windows)
> and have it copied into the output directory. Then load it in when you
> initialize the application with
> Gtk.Rc.Parse("gtkrc-win32");
> There's probably also a way to have the file embedded as a resource and
> loaded from the assembly if having extra runtime files is something that
> concerns you. The key lines in this file are
> engine "wimp"
>   {
>   }
> in the default style. If you want to run the app on Linux as well, just
> use
> a different rc file without those lines and have it copied instead in the
> MonoDevelop build setup.
> Cheers and good luck with you Gtk# development!
> - Andy
> On Sun, Nov 30, 2008 at 8:51 AM, D. Dobrev <dpldobrev at yahoo.com> wrote:
>> Thank you for the fast response, Stifu. I used the following line of code
>> to
>> try your test:
>> this.Title = IsMono().ToString();
>> and it displayed "False" in both cases, i.e the app doesn't use Mono on
>> Windows. Actually, I don't have Mono for Windows installed, only GTK#.
>> The
>> problem is that this also happens with the GTK# (version 2.10) that is
>> supplied in the Mono Downloads section.
>> Stifu wrote:
>> >
>> > To me, it looks like the first screenshot uses MS .NET, while the
>> second
>> > one uses Mono (thought I don't understand why it'd run Mono by default
>> > when simply launching a file from the explorer). You could make sure
>> and
>> > find out which framework is used with a function like:
>> >
>> > public static bool IsMono()
>> > {
>> >       if(Type.GetType("System.MonoType", false) != null)
>> >       {
>> >               return true;
>> >       }
>> >       return false;
>> > }
>> >
>> > Native Windows theming will be included in Mono 2.2, due out in
>> > December... So this should fix your problem, I think (unless it only
>> > concerns programs that use Windows.Forms and not GTK#? I don't know, I
>> > guess someone else could clear that up).
>> >
>> --
>> View this message in context:
>> http://www.nabble.com/Windows-theme-not-applied-tp20758097p20758370.html
>> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
>> _______________________________________________
>> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

View this message in context: http://www.nabble.com/Windows-theme-not-applied-tp20758097p20760561.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list