Bitmap.FromHicon メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim hicon As IntPtr Dim returnValue As Bitmap returnValue = Bitmap.FromHicon(hicon)
戻り値
このメソッドが作成する Bitmap。

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgs の e が必要です。このコードは次のアクションを実行します。
<System.Runtime.InteropServices.DllImportAttribute("user32.dll")> _ Private Shared Function LoadImage(ByVal Hinstance As Integer, ByVal name As String, ByVal type As Integer, ByVal width As Integer, ByVal height As Integer, ByVal load As Integer) As IntPtr End Function Public Sub HICON_Example(ByVal e As PaintEventArgs) ' Get a handle to an icon. Dim Hicon As IntPtr = LoadImage(0, "smile.ico", 1, 0, 0, 16) ' Create a Bitmap object from the icon handle. Dim iconBitmap As Bitmap = Bitmap.FromHicon(Hicon) ' Draw the Bitmap object to the screen. e.Graphics.DrawImage(iconBitmap, 0, 0) End Sub
[System.Runtime.InteropServices.DllImportAttribute("user32.dll")] private static extern IntPtr LoadImage(int Hinstance, string name, int type, int width, int height, int load); public void Hicon_Example(PaintEventArgs e) { // Get a handle to an icon. IntPtr Hicon = LoadImage(0, "smile.ico", 1, 0, 0, 16); // Create a Bitmap object from the icon handle. Bitmap iconBitmap = Bitmap.FromHicon(Hicon); // Draw the Bitmap object to the screen. e.Graphics.DrawImage(iconBitmap, 0, 0); }
private: [System::Runtime::InteropServices::DllImportAttribute("user32.dll")] static IntPtr LoadImage( int Hinstance, String^ name, int type, int width, int height, int load ); public: void Hicon_Example( PaintEventArgs^ e ) { // Get a handle to an icon. IntPtr Hicon = LoadImage( 0, "smile.ico", 1, 0, 0, 16 ); // Create a Bitmap object from the icon handle. Bitmap^ iconBitmap = Bitmap::FromHicon( Hicon ); // Draw the Bitmap object to the screen. e->Graphics->DrawImage( iconBitmap, 0, 0 ); }

- SecurityPermission (アンマネージ コードを呼び出すために必要なアクセス許可)。UnmanagedCode (関連する列挙体)

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からBitmap.FromHicon メソッドを検索する場合は、下記のリンクをクリックしてください。

- Bitmap.FromHicon メソッドのページへのリンク