问题
How can I set a picture to a PictureBox in code?
The code below gives me the error:
Cannot implicitly convert Bitmap to String.
private void ptbLocalidadAdd_MouseEnter(object sender, EventArgs e)
{
ptbLocalidadAdd.ImageLocation = Properties.Resources.addg;
}
回答1:
If the resource is a bitmap, this should work:
ptbLocalidadAdd.Image = Properties.Resources.addg;
来源:https://stackoverflow.com/questions/3845500/setting-a-picture-from-my-resources-programmatically-to-a-picturebox