[Gtk-sharp-list] Windows theme not applied
Andy Selvig
ajselvig at gmail.com
Sun Nov 30 12:48:52 EST 2008
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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20081130/387e6591/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtkrc-win32
Type: application/octet-stream
Size: 1236 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20081130/387e6591/attachment.obj
More information about the Gtk-sharp-list
mailing list