以编程方式将图片从我的资源设置为PictureBox [英] Setting a picture from my Resources programmatically to a PictureBox
本文介绍了以编程方式将图片从我的资源设置为PictureBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将图片设置为 PictureBox 在代码中?
How can I set a picture to a PictureBox in code?
下面的代码给我错误:
无法将位图隐式转换为 字符串.
Cannot implicitly convert Bitmap to String.
private void ptbLocalidadAdd_MouseEnter(object sender, EventArgs e)
{
ptbLocalidadAdd.ImageLocation = Properties.Resources.addg;
}
推荐答案
如果资源是位图,这应该可以工作:
If the resource is a bitmap, this should work:
ptbLocalidadAdd.Image = Properties.Resources.addg;
这篇关于以编程方式将图片从我的资源设置为PictureBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文