Clock
Clock

Reputation: 984

Where is the form icon saved in a WinForms application?

I don't know where is the icon of an form saved...

I actually search it in project resources and did not found it, also it is not specified any path to it into the Properties of the form, still it occurs on form.

Is it somewhere serialized ? I just trying to find it and modify it and be sure that the new added icon will stay there...

Is it enough to just set a new icon from the form properties of the form and that one will automatically be saved in the location of the old one ?

To be more specific I also added a picture having an example with the icon of a form that I am talking about.

enter image description here

Upvotes: 1

Views: 2468

Answers (1)

user5684647
user5684647

Reputation:

Open your form in the designer. Open the Properties box. Click the form to select it. Look for the "Icon" element in the Properties box in the Window Style group.

If you change the icon via the Properties box, then look at your designer code, you will see something like this (Form1.Designer.cs):

        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(1008, 540);
        this.Controls.Add(this.btnTestReplacePerformance);
        this.Controls.Add(this.label3);
        this.Controls.Add(this.txtResults);
        this.Controls.Add(this.btnGetMatches);
        this.Controls.Add(this.txtSource);
        this.Controls.Add(this.txtRegex);
        this.Controls.Add(this.label2);
        this.Controls.Add(this.label1);
        this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
        this.Name = "Form1";
        this.Text = "Form1";
        this.ResumeLayout(false);
        this.PerformLayout();

And you can see that the icon (this.Icon) is loaded from the resources.

Upvotes: 3

Related Questions