积极答复者
vs2003中pictureBox的問題!急!!!

问题
答案
-
你好,
是否是资源加载的问题。
如果是嵌入资源的方式,在新建的windows窗体resx文件中,添加资源,添加现有文件,选择你要的图片,然后用PictureBox1.Image = resources.GetObject("PictureBox1.Image") 其中”PictureBox1.Image“是文件名。
如果是采用间接的方式,则需要给出图片的绝对路径,不能给出相对路径,如:PictureBox1.Image = New Bitmap(FileName)。
施炯- 已建议为答案 Jiong ShiMVP 2011年7月14日 9:43
- 已标记为答案 Jiong ShiMVP 2011年7月16日 23:30
2011年7月12日 6:16 -
你好,
假设resources是你自己写的一个ResourceManager,同时“pictureBox1.Image”是你要赋值的Image的ResourceID。出现未处理例外状况通常是由于错误的赋予了Image值。你可以检查一下目标图像是否存在,ID是否正确。如果可能的话,你也可以post出更多代码来帮忙我们定位问题所在。
谢谢
Yves Zhang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已建议为答案 Jiong ShiMVP 2011年7月14日 9:43
- 已标记为答案 Jiong ShiMVP 2011年7月16日 23:30
2011年7月14日 9:22
全部回复
-
你好,
是否是资源加载的问题。
如果是嵌入资源的方式,在新建的windows窗体resx文件中,添加资源,添加现有文件,选择你要的图片,然后用PictureBox1.Image = resources.GetObject("PictureBox1.Image") 其中”PictureBox1.Image“是文件名。
如果是采用间接的方式,则需要给出图片的绝对路径,不能给出相对路径,如:PictureBox1.Image = New Bitmap(FileName)。
施炯- 已建议为答案 Jiong ShiMVP 2011年7月14日 9:43
- 已标记为答案 Jiong ShiMVP 2011年7月16日 23:30
2011年7月12日 6:16 -
你好,
假设resources是你自己写的一个ResourceManager,同时“pictureBox1.Image”是你要赋值的Image的ResourceID。出现未处理例外状况通常是由于错误的赋予了Image值。你可以检查一下目标图像是否存在,ID是否正确。如果可能的话,你也可以post出更多代码来帮忙我们定位问题所在。
谢谢
Yves Zhang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已建议为答案 Jiong ShiMVP 2011年7月14日 9:43
- 已标记为答案 Jiong ShiMVP 2011年7月16日 23:30
2011年7月14日 9:22