[1.1] 自分が今行いたい事は何か
C#でアイコンを読み込み、表示させたい
[1.2] どのように取り組んだか(プログラムコードがある場合記載)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace リスト6_14_アイコンの描画
{
public partial class Form1 : Form
{
private Icon icon;
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (icon == null)
icon = new Icon("test.ico");
e.Graphics.DrawIcon(icon, 0, 0);
e.Graphics.DrawIcon(icon, new Rectangle(icon.Width, 0, 200, 200));
}
public Form1()
{
InitializeComponent();
}
}
}
ソースコードの20行目で停止
ArgumentExceptionはハンドルされませんでした。
引数 picture は Icon として使用できるピクチャでなければなりません。
というダイアログボックスが出る
[1.4] 今何がわからないのか、知りたいのか
アイコンのファイルは正常なアイコンの情報を持っているか
ソースコードに問題点はないのか
[2] 環境
[2.1] OS : Windows, Linux等々
OS:Windows7 32ビット HomeEdition
[2.2] コンパイラ名 : VC++ 2008EE, Borand C++, gcc等々
コンパイラ:Visual C# 2010 Express
[3] その他
・どの程度C言語を理解しているか
オブジェクト指向を理解できる、作成できる
・ライブラリを使っている場合は何を使っているか
今回は.NETを使っている(?)