ehh
ehh

Reputation: 3480

png on a window form button is not visible at run-time

I am facing a weird issue while trying to create a window form button with a backgroundimage set to a png file. I have created the png picture through a glass button generator online. I am not sure maybe I am missing to set a property on the button properties. I am generating the glass button png file through http://dabuttonfactory.com. I am setting the BackgroundImage of the button in design mode and I can see the image properly. The problem is at run time.

EDIT: I tried to copy the code from the designer to show you the code but I couldn't find the printButton control I added. After some deletion of the controls on my form, I was able to display the button. But then, instead of putting a button on the form, I put a picturebox and set the image to the png file and again I cannot see the picturebox control in the designer.

    private System.Windows.Forms.StatusStrip statusStrip1;
    private System.Windows.Forms.ToolStripStatusLabel UserInfoTSSL;
    private System.Windows.Forms.ToolStripStatusLabel ConnectionModeTSSL;
    private System.Windows.Forms.SplitContainer splitContainer1;
    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.Button button3;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.Button button1;

Upvotes: 0

Views: 1603

Answers (2)

Tanmay Nehete
Tanmay Nehete

Reputation: 2206

Try to set bgimage layout Stretch mode /zoom mode

Or try to put file in Application resource some time it may not able to retrieve the image file path

Upvotes: 0

ehh
ehh

Reputation: 3480

It is a Visual Studio 2015 bug. I had reopen my solution, now it works fine. I though it was related to the generated png file but it is not.

Upvotes: 1

Related Questions