Visual C# 窗体背景图片
我在申请表中使用了 JPG 作为背景图像。 我的问题是,我总是需要带有 exe 程序的 JPG 吗?
因此,如果我将我的 exe 程序提供给其他用户,如果我不提供 JPG 文件,该人将无法查看背景图像?
另一个问题是关于我用于程序的图标(exe 图标和显示在程序顶部的图标)..这些图标是否存储在程序中?或者我需要提供图标文件?
抱歉,我只有一台机器,没有人为我测试。
干杯, D
I have used a JPG for backgroundImage for an application form.
My question is that do I always need the JPG with the exe program?
So if I give my exe program to another user, the person won't be able to view the backgroundImage if I dont provide the JPG file?
another question is regarding the icons that I use for the program (exe icon and an icon that displays at top of your program).. are these icons stored in the program? or i need to provide the icon file(s)?
sorry i only have a machine and don't have someone to test for me.
cheers,
D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要添加图像作为应用程序的资源。如果您只是将其添加为文件链接,例如 C:\somelocation,一旦更改您就会丢失图像。
如果将其添加为资源,则它会包含在构建中并始终存在于应用程序中。
要了解有关如何执行此操作的更多信息,请查看此处:
http://msdn.microsoft.com/en-us/library/7k989cfy%28v=vs.80%29.aspx
http://www.homeandlearn.co.uk/csharp/csharp_s4p8.html
You need to add image as a resource for the Application. If you add it simply as a file link e.g. C:\somelocation as soon as that changes you loose teh image.
If its added as a resource then it is inculded with the build and always present for the Application.
To know more on how to do this look here:
http://msdn.microsoft.com/en-us/library/7k989cfy%28v=vs.80%29.aspx
http://www.homeandlearn.co.uk/csharp/csharp_s4p8.html
一个简单的测试是将 .exe 放在单独的文件夹中并尝试启动它。
对于 JPG,这取决于您在程序中如何引用它,如果它是您添加的资源,它将位于可执行文件中。
该图标应该已经在可执行文件中。
An easy test would be to put the .exe in a separate folder and try to launch it.
For the JPG it depends how you refer to it in your program, if it is a resource that you added it will be in the executable.
The icon should be in the executable already.
您可以将 .jpg 文件添加为应用程序中的资源,这会导致该文件被编译到 .exe 本身中,从而减少了一个要分发的文件。
查看访问项目资源中的图像?
You can add the .jpg file as a resource in your application, which results in it being compiled into the .exe itself, giving you one less file to distribute.
Check out Accessing an image in the projects resources?