#region 把指定图片传给PictureBox
/// <summary>
/// 把指定图片传给PictureBox
/// </summary>
/// <param name="PicBox">PictureBox</param>
/// <param name="PicPath">图片路径</param>
/// <returns>bool</returns>
public static bool JZTP(System.Windows.Forms.PictureBox PicBox,string PicPath)
{
PicBox.Image = null;
if (MyClass.IsExistFile(PicPath))
{
System.Drawing.Image tmpPic = System.Drawing.Image.FromFile(PicPath);
Bitmap tmpPicNew = new Bitmap(tmpPic, PicBox.Width, PicBox.Height);
PicBox.Image = System.Drawing.Image.FromHbitmap(tmpPicNew.GetHbitmap());
return true;
}
else
{
return false;
}
}
#endregion
C#把图片传给picturebox
最新推荐文章于 2023-02-21 23:02:31 发布