2

I need to change GUI theme in GTK#. I tried something, but it is still far from ideal. Here is my code:

        string Resource_File = "Black-Diamond\\gtk-2.0\\gtkrc";
        Application.Init ();
        if (System.IO.File.Exists (Resource_File)) {
            Gtk.Rc.AddDefaultFile (Resource_File);
            Gtk.Rc.Parse (Resource_File);
        } else {
            ;
        }
        MainWindow win = new MainWindow ();
        win.Show ();
        Application.Run ();

Output:

enter image description here

That's ok, but not what I expected(some elements don't look like in original theme).

Can you tell me how I can change GUI theme in GTK# on windows? Thanks!

konstantin_doncov
  • 2,725
  • 4
  • 40
  • 100
  • I am uncertain if you are using gtk2 or gtk3. (Pardon me if it was stated and I missed it). – ThorSummoner Oct 13 '14 at 23:44
  • 1
    The Murrine gtk2 engine themes are likely not 100% compatible with the gtk2 rendering engine for WindowsNT. If I recall right, Murrine was one of the more complex engines. I would personally encourage you to not focus on theming your desktop application until last, as you will likely have to tweak the theme for a windows install and drop many of the shiny frills Murrine boasts. You might also like to find a windows compatible gtk2 factory for testing themes. The one I use for gtk2 is python based https://github.com/Aurora-and-Equinox/PyTWF However installing and setting the theme is nottrivial – ThorSummoner Oct 13 '14 at 23:55
  • As far as I can see, you correctly loaded the GTK theme, so these steps are correct. The problem appears after the GTK theme loading, when the theme is not correctly rendered because an unknown reason. Maybe what you should ask is why the theme doesn't work on Windows. Have you tried it on Linux to see if there are differences? – castarco Oct 15 '14 at 08:50
  • @ThorSummoner I think he is using GTK2, because there is no official support for GTK# 3 in Windows. – castarco Oct 15 '14 at 08:51
  • @castarco No, I just have an original screenshots of the theme, and there are different. May be I just use theme which can't correctly renderer on windows? Can you tell, what theme do you use? – konstantin_doncov Oct 15 '14 at 09:55
  • @user2656632 , ThorSummoner told you that Murrine GTK themes can be problematic on Windows. The point isn't if you loaded the theme (because it's correctly loaded), but if it can be rendered (and seems that it can't be rendered under Windows NT derivatives, like Windows 7). – castarco Oct 15 '14 at 09:57
  • @castarco this time I tried to use another theme and now it works almost perfect! Thanks! – konstantin_doncov Oct 15 '14 at 19:09

0 Answers0