在图片框中添加图像 Windows 窗体 [英] Adding an image in a picture box Windows Form

查看:68
本文介绍了在图片框中添加图像 Windows 窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Windows 窗体来以富文本格式显示文本,然后添加了一个图片框来为其添加一些颜色.当我加载表单时,它看起来像这样:

I created a windows form to display text in a richtext and then added a picture box to add some color to it. at the moment when I load up the form it looks like this:

富文本上方的点是我添加图片框的位置,当我尝试将图像添加到图片框时,它给了我一个错误:值不能为空.参数名称:docData. 我通过转到图片框的属性和图像女巫被标记(无)得到这个错误.

The dot above the rich text is the location of were I added the picture box, at the moment when I try to add an image to picture box it gives me an error: Value cannot be null. Parameter name: docData. I get this error by going to the properties of the picture box and to Image witch is labled (none) at the moment.

我如何解决我遇到的这个问题.(我使用 C# 2010 Express、XNA Game Studio 4.0、Windows Game(4.0))

How do I fix this problem that I am having. (I use C# 2010 Express, XNA Game Studio 4.0, Windows Game(4.0))

推荐答案

这似乎是 Windows 游戏 (4.0) 问题.请参阅 这个 页面.您可以尝试在代码中设置图像,如下所示:

This seems to be a Windows Game (4.0) issue. See the answer on this page. You could try to set the image in your code like this:

pictureBox1.Image = Image.FromFile("path/somefile.jpg");

根据这个页面,这个问题是一个错误未修复.

According to this page, this problem is a bug that hasn't been fixed.

这篇关于在图片框中添加图像 Windows 窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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