c# - 如何在wpf中设置位图的来源
问题描述
我想从文件夹“图像”中设置位图的来源。该文件夹中图像的属性设置为
- 构建操作:资源
- 复制到输出目录:不要复制
我可以在 Winform 中正确设置如下,
Bitmap bmp_testing = TestAPP.Properties.Resources.testImg;
但是在 WPF 上我得到了错误 - 无效的参数。
Bitmap bmp_testing = new Bitmap("/images/testImg.png");
我不想使用 BitmapImage。请建议如何在 WPF 中设置位图的来源。
解决方案
推荐阅读
- python - Python 字典 - 只需要几对 - 弹出未使用的对还是制作新字典更好?
- matlab - 八度跳过参数
- python - Tensorflow:保存/恢复加载不正确的变量
- c++ - 在 MySQL Connector C++ API 中使用一个函数调用执行多个查询的正确方法是什么?
- javascript - 从 FlatList 中选择一个项目并将值传递给变量状态
- redux - 流程:在 reducer 中的操作之间进行选择
- python - return redirect() 在 Flask 之前使代码无效
- javascript - 从一个偶数监听器函数切换到另一个
- html - 无论如何在引导程序中以 992px 的屏幕尺寸显示导航栏汉堡包?
- ios - 使用单击的按钮通过 tableView 传递数据