Displaying an icon in a picturebox

后端 未结 3 1182
清酒与你
清酒与你 2020-12-17 19:21

I am trying to display icon file in a picture box. I\'m using this code to set the image.

pictureBox1.Image = new Icon(openFileDialog.FileName,          


        
3条回答
  •  抹茶落季
    2020-12-17 19:47

    Solved the problem.

    pictureBox1.Image = Bitmap.FromHicon(new Icon(openFileDialog.FileName, new Size(48, 48)).Handle);
    

提交回复
热议问题