在尝试创建一个backgroundimage设置为png文件的窗体窗口按钮时,我遇到了一个奇怪的问题。我通过在线玻璃按钮生成器创建了png图片。我不确定是否可能缺少在按钮属性上设置属性。 我正在通过http://dabuttonfactory.com生成玻璃按钮png文件。 我在设计模式下设置按钮的BackgroundImage,我可以正确地看到图像。问题出在运行时。
编辑: 我试图从设计器中复制代码以显示代码,但我找不到我添加的printButton控件。删除表单上的控件后,我能够显示按钮。 但是,我没有在表单上放一个按钮,而是放置了一个图片框并将图像设置为png文件,再次看不到设计器中的图片框控件。
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;
答案 0 :(得分:0)
尝试设置bgimage布局拉伸模式/缩放模式
或者尝试将文件放在Application资源中某段时间它可能无法检索图像文件路径
答案 1 :(得分:0)
这是Visual Studio 2015错误。我重新打开了我的解决方案,现在它运行正常。 我虽然它与生成的png文件有关,但它不是。