hi,

I am creating a form on runtime using the following code. how would i be able to change the icon to something in resources as i dont have access to it.

Window mainForm = new Window
                                  {
                                      Height = 340,
                                      Width = 315,
                                  };

thanks

Recommended Answers

All 2 Replies

Maybe this might help you out:

private void Form1_Load(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.MyPic.ico; //MyPic is the icon in your resources!
        }

hi thanks for reply one question when creating the form should i hook to this even? or is there any other way to hook to load event also i forgot to mention im creating this form from xaml(wpf) page....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.