久久久久久久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(刪除菜單項周圍的細邊框)
主站蜘蛛池模板: 国产综合av | 91影院在线观看 | 欧美精品一区二区三区蜜桃视频 | 在线播放亚洲 | 国产我和子的乱视频网站 | 欧美日韩一区二区在线 | 亚洲一区二区三区桃乃木香奈 | 国产精品欧美一区二区 | av一区二区三区四区 | 国产一区二区三区四区三区四 | 久久小视频 | 亚洲综合首页 | 一级片在线免费看 | 中文字幕亚洲一区 | 日本成人片在线观看 | 午夜激情免费视频 | 免费高清av | 亚洲综合一区二区三区 | 精品一区二区三区在线观看 | 91精品国产综合久久福利软件 | 成人一区二区三区 | 中文字幕一区二区不卡 | 九九伦理电影 | 日韩视频精品在线 | 中文字幕精品一区二区三区精品 | 免费一级淫片aaa片毛片a级 | 精品一区二区三区四区 | 午夜精品久久久 | 欧美伊人影院 | 亚洲3级 | 中文字幕一区二区三区精彩视频 | 一区在线视频 | 欧美三区在线观看 | 久久精品国产a三级三级三级 | 草比网站 | 亚洲欧美综合 | 国产精品久久久久久久免费观看 | 国产在线观看福利 | 91视频18 | 国产亚洲精品精品国产亚洲综合 | 国产精品久久久久久238 |