画像を表示することになっている単純なWindowsフォームアプリケーションC#を作成しました。私はここからチュートリアルに従っています以下はform1.csのコードです
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
// Construct an image object from a file in the local directory.
// ... This file must exist in the solution.
Image image = Image.FromFile("Picture1.png");
// Set the PictureBox image property to this image.
// ... Then, adjust its height and width properties.
pictureBox1.Image = image;
pictureBox1.Height = image.Height;
pictureBox1.Width = image.Width;
}
}
イメージはソリューションフォルダーにありますが、アプリケーションの実行時にウィンドウに何も表示されません。コンパイルエラーはありません。
アップデート
その解決しました。