joshua-anderson
joshua-anderson

Reputation: 4466

GTK# Window Icon Not working

Does anyone know why this fails to run. I have this code and a file named logo.png in the same directory. Then I run this code and it fails, saying it cant find the file

using System;
using Gtk;

public class Trackbox {

    static int Main() {
        Application.Init();

        //Create the Window
        Window myWin = new Window("TrackBox");
        myWin.SetIconFromFile("logo.png");
        myWin.Resize(200, 100);


        //Create a label and put some text in it.     
        Label myLabel = new Label();
        myLabel.Text = "Welcome to TrackBox";

        //Add the label to the form     
        myWin.Add(myLabel);

        //Show Everything     
        myWin.ShowAll();

        Application.Run();

        return 0;
    }
}

It returns an error saying it can't find logo.png... Why is this? Thanks for the help.

Upvotes: 3

Views: 1153

Answers (1)

joshua-anderson
joshua-anderson

Reputation: 4466

The solution was to place the icon next to the executable. I though the icon had to be in the root solution folder but it actually looks in the root executable folder.

Upvotes: 3

Related Questions