指定のアセンブリのリソースで Icon クラスの新しいインスタンスを初期化します。
名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文
'宣言
Public Sub New ( _
type As Type, _
resource As String _
)
'使用
Dim type As Type
Dim resource As String
Dim instance As New Icon(type, resource)
public Icon (
Type type,
string resource
)
public:
Icon (
Type^ type,
String^ resource
)
public Icon (
Type type,
String resource
)
public function Icon (
type : Type,
resource : String
)
パラメータ
- type
リソースを検索するアセンブリを指定する Type。
- resource
読み込むリソース名。
解説
このコンストラクタでは、type パラメータで指定された型が含まれているアセンブリの、resource パラメータで指定された名前のリソースから Icon を作成します。
使用例
Icon コンストラクタを使用する方法を次のコード例に示します。この例を実行するには、コードを Windows フォームに貼り付け、フォームの Paint イベントを処理します。Paint イベント ハンドラから ConstructAnIconFromAType メソッドを呼び出し、e を EventArgs として渡します。
Private Sub ConstructAnIconFromAType(ByVal e As PaintEventArgs)
Dim icon1 As New Icon(GetType(Control), "Error.ico")
e.Graphics.DrawIcon(icon1, New Rectangle(10, 10, 50, 50))
End Sub
private void ConstructAnIconFromAType(PaintEventArgs e)
{
Icon icon1 = new Icon(typeof(Control), "Error.ico");
e.Graphics.DrawIcon(icon1, new Rectangle(10, 10, 50, 50));
}
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0