移动应用程序中的图像 [英] image in mobile application

查看:64
本文介绍了移动应用程序中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想在移动应用程序中显示图像.我有图片框.我必须在其中显示图像.

Hello,

I want to display an image in my mobile application.I have picturebox.I have to display an image in that.

pictureBox1.Image = new Bitmap("\\My Documents\\My Pictures\\waterfall.jpg");



这是有效的,因为它是模拟器的内部映像.尝试自定义映像时未显示该映像.我没有在该映像中将映像部署到项目中的路径.任何人都可以帮忙吗? (WM 5.0)



This is working.Because it is internal image for the emulator. While trying for custom image it is not displaying.I didn''t get the path of that image where it is deploying the image in the project.any one can help? (WM 5.0)

推荐答案

我不确定您要执行的操作会给您带来什么问题.

如果您这样做:
I''m not quite sure what you are trying to do that is giving you a problem.

If you do this:
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
    {
    pictureBox1.Image = new Bitmap(ofd.FileName);
    }

它有效.如果直接指定图像的路径,它将起作用.

It works. If you specify the path to the image directly, it works.

pictureBox1.Image = new Bitmap(@"\My Documents\My Pictures\Flower.jpg");

那我想念什么?


我想从本地系统文件夹中拍摄一张图像,然后将其放置为该应用程序的标题.它将起作用吗?"

是的.您所要做的就是提供路径:

So what am I missing?


"From local system folder i want take an image and i want to place it as header of that app. will it work?"

Yes. All you have to do is provide the path:

pictureBox1.Image = new Bitmap(@"\Windows\Flower.jpg");

还是您要从PC上拿走它?因为如果是这样,当您移出仿真器并进入真实物体时,那将不起作用...


其给出相同的找不到文件错误".图像位于项目的图像文件夹中.我认为在此之前,图像需要复制到模拟器中..如果是这样,如何将图像复制到模拟器中.你能告诉吗?"

1)在您的项目中,在解决方案资源管理器中打开Images文件夹.
2)高亮显示您想要的图像.
3)在属性窗格中,设置:
3a)建立动作:内容
3b)复制到输出目录:如果较新则复制

然后在您的代码中:

Or are you trying to take it from your PC? Because if so, that won''t work when you move out of the emulator and into the real thing...


"its giving same "file not found error".Image is in images folder of the project.I think Before this the image need to copy to the emulator?..if so, how to copy that image to emulator..can you tell?"

1) In your project open the Images folder in Solution Explorer.
2) Highlight the image you want.
3) In the properties pane, set:
3a) Build Action: Content
3b) Copy to Output Directory: Copy If Newer

Then in your code:

string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
pictureBox1.Image = new Bitmap(path + @"\Images\MyImageFile.jpg");


这篇关于移动应用程序中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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