久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

C# WPF 從 exe 文件夾加載圖像

C# WPF Load images from the exe folder(C# WPF 從 exe 文件夾加載圖像)
本文介紹了C# WPF 從 exe 文件夾加載圖像的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想將我的程序從一臺電腦移到另一臺電腦,但問題是圖像沒有加載到任何其他電腦上(源問題).所以我想知道我是否可以創(chuàng)建一個放置 exe 的文件夾并將其命名為 Resources 并從那里加載每個圖像.

image2.Source = new BitmapImage(new Uri(@"Resstartoh.png"));

解決方案

您可以將圖像作為資源添加到您的 Visual Studio 項目中.然后它們將被打包到可執(zhí)行文件的程序集中,您無需單獨復制它們.

在您的項目中創(chuàng)建一個文件夾(假設(shè)名為 Images)并將您的圖像添加到該文件夾??中.

確保圖像的:

var uri = new Uri("pack://application:,,,/Images/SomeImage.png");image.Source = new BitmapImage(uri);

i want to move my program from a pc to another but the problem is the images are not loaded on any other pc (Source problem) . So i was wondering if i could just create a folder where the exe is placed and name it Resources and to load every image from there.

image2.Source = new BitmapImage(new Uri(@"Resstartoh.png"));

解決方案

You may just add the images as resources to your Visual Studio project. Then they will be packed into the assembly of the executable and you don't need to copy them separately.

Create a folder in your project (let's say called Images) and add your images to that folder.

Make sure that the Build Action for the images is set to Resource.

Now you can simply create a BitmapImage from such a resource by an appropriate Pack URI:

var uri = new Uri("pack://application:,,,/Images/SomeImage.png");
image.Source = new BitmapImage(uri);

這篇關(guān)于C# WPF 從 exe 文件夾加載圖像的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Right-click on a Listbox in a Silverlight 4 app(右鍵單擊 Silverlight 4 應用程序中的列表框)
WPF c# webbrowser scrolls over top menu(WPF c# webbrowser 在頂部菜單上滾動)
C# Console app - How do I make an interactive menu?(C# 控制臺應用程序 - 如何制作交互式菜單?)
How to avoid duplicate form creation in .NET Windows Forms?(如何避免在 .NET Windows Forms 中創(chuàng)建重復的表單?)
UI Automation Control Desktop Application and Click on Menu Strip(UI自動化控制桌面應用程序并單擊菜單條)
Removing thin border around the menuitems(刪除菜單項周圍的細邊框)
主站蜘蛛池模板: 国产精品一区二区久久 | 看一级毛片视频 | 欧美h视频 | 国产一区在线免费 | 在线午夜 | 日韩中文一区二区三区 | 国产精品国产自产拍高清 | 亚洲免费高清 | 特黄特色大片免费视频观看 | 欧美久久久网站 | 亚洲区在线 | 欧美性久久 | 97精品超碰一区二区三区 | 亚洲国产精品va在线看黑人 | a级毛片毛片免费观看久潮喷 | 亚洲午夜精品一区二区三区他趣 | 中文字幕在线观看视频一区 | 欧美日韩国产精品一区 | 日韩不卡一区二区三区 | 亚洲在线一区 | 亚洲欧美中文日韩在线v日本 | 99热碰| 日韩在线观看网站 | 超级乱淫av片免费播放 | 国产一级淫片a直接免费看 免费a网站 | 国产精品久久久久久久久久久久久 | 国产一区二区麻豆 | 99久久婷婷国产亚洲终合精品 | 成人欧美一区二区三区黑人孕妇 | 日韩免费激情视频 | 中文字幕在线免费视频 | 亚洲免费精品 | 国产高清视频 | 国产在线观 | www.亚洲国产精品 | 激情六月丁香 | 精品欧美一区二区三区久久久 | 精品免费国产 | 91免费在线 | 91大神xh98xh系列全部 | 自拍偷拍第一页 |