VS C#无法将图像添加到Windows.Form中的按钮 [英] VS C# Can't add image to a button in Windows.Form

查看:78
本文介绍了VS C#无法将图像添加到Windows.Form中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试设置按钮的图像属性时,我都会收到一个弹出错误,指出

"已经添加了一个具有相同键的项目。

每当我创建一个新按钮并尝试设置图像时,也会发生此错误。我有一种感觉错误与项目的资源文件有关,任何帮助都将非常感谢!!!

解决方案

@DarkArchon


如果你能提供一个代码片段,说明你正在做什么来创建按钮并分配一个有用的图像。

< br>

@tlhintoq


我同意,一段代码对我们有帮助。

另外,你能否提供有关你问题的更多细节......比如......

你是否动态创建按钮?

你如何分配图片?


请记得使用代码标签


-Frinny


< blockquote>好吧我会发布代码,除了当我处于设计师模式时问题存在。单击按钮,转到它的属性,然后尝试选择图像...按钮时发生错误。


Whenever I try to set the image property of button I get a pop-up error which states
"An item with the same key has already been added."
This error also happens whenever I create a new button and try to set the image. I have a feeling the error has something to do with the resources file for the project, any help would be greatly appreciated!!!

解决方案

@DarkArchon
If you could provide a code snippet of what you are doing to create the button and assign an image that would help a lot.


@tlhintoq
I agree, a snippet of code would really help us.

Also, could you provide more details about your problem...like...
Are you dynamically creating the button?
How are you assigning the image?

Please remember to use Code Tags when posting code.

-Frinny


Well I would post the code except that the problem exists when I am in the designer mode. The error occurs when I click on a button, go to it''s properties, and try to choose image ... button.


这篇关于VS C#无法将图像添加到Windows.Form中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆