如何访问我的解决方案浏览器图像 [英] HOW TO ACCESS MY SOLUTION EXPLORER IMAGE

查看:42
本文介绍了如何访问我的解决方案浏览器图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在C#语言中使用Windows应用程序.

我想为图像设置面板背景.编码.我正在使用panel1.setBackground("C:\\ Documents and Settings \\ Administrator \\ My Documents \\ Downloads \\ playlistmoves \\ Resources \\ container.JPG");

上面的setbackground效果很好.

但是,同一张container.jpg图片中我有我的解决方案资源管理器或资源"文件夹.不使用本地主机路径,如何访问我的资源映像.

SetBackground("??????");


问候
Vasanth

Hi Guys,

I am using windows Application with C# Languvage.

I want to set the panel background for image via. Coding. I am using panel1.setBackground("C:\\Documents and Settings\\Administrator\\My Documents\\Downloads\\playlistmoves\\Resources\\container.JPG"");

This above setbackground is works good.

But that same container.jpg image i have my solution Explorer inside or Resource folder. Without using the local host path how can i access my Resource image.

SetBackground(" ?????? ");


Regards
Vasanth

推荐答案

非常容易做到.您需要将图像作为资源嵌入到项目中.
步骤:
1.展开属性.您将找到Resources.resx.右键单击并打开.
2.单击添加资源->添加现有文件.从磁盘中选择图像,或者container.JPG.将图像的名称更改为容器"
3.在您的代码中,您只需要将SetBackground代码更改为此,
Pretty easy to do. You need to embedd the image as a resource in your project.
Steps:
1. Expand Properties. You will find Resources.resx. Right Click and Open.
2. Click on Add Resource -> Add Existing File. Choose the image from the disk, container.JPG perhaps. Change the name of the image to "Container"
3. In your code you just have to change the SetBackground code to this,
panel1.BackgroundImage = Properties.Resources.Container;



就这样...尽情享受



That''s it... enjoy


这就是您的解决方案资源管理器路径

This one is your solution explorer path

Application.StartupPath + @"\container.JPG"



希望它能对您有帮助...



Hope it will help you...


答案很复杂,您应该在线阅读有关它的文章,以涵盖所有详细信息.我用谷歌搜索了您的问题,发现了 [
The answer is complex enough that you should read an article about it online, to cover all the details. I googled your question and found this[^].


这篇关于如何访问我的解决方案浏览器图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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