コード上で指定した画像をPictureBoxに表示させたいのですが、コンパイル中に
System.OutOfMemoryException: 'メモリが不足しています。'
と表示されて、思うように動作しません。
どうすればよいのか、教えてください。
該当のソースコード
c#
1using System; 2using System.Collections.Generic; 3using System.ComponentModel; 4using System.Data; 5using System.Drawing; 6using System.Linq; 7using System.Text; 8using System.Threading.Tasks; 9using System.Windows.Forms; 10 11namespace WindowsFormsApp14 12{ 13 public partial class Form1 : Form 14 { 15 public Form1() 16 { 17 InitializeComponent(); 18 } 19 20 private void Form1_Load(object sender, EventArgs e) 21 { 22 Image im = Image.FromFile(@"C:\Users\owner\source\repos\WindowsFormsApp14\WindowsFormsApp14\Form1.cs"); 23 Bitmap bm = new Bitmap(im); 24 pictureBox1.Image = bm; 25 im.Dispose(); 26 } 27 } 28} 29
実行中ではなくて、コンパイル中ですか??
回答1件
あなたの回答
tips
プレビュー