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

Dim hfont As IntPtr Dim returnValue As Font returnValue = Font.FromHfont(hfont)
戻り値
このメソッドが作成する Font。

次の例は、Windows フォームでの使用を意図してデザインされており、Paint イベント ハンドラのパラメータである PaintEventArgse が必要です。このコードは次のアクションを実行します。
<System.Runtime.InteropServices.DllImportAttribute("GDI32.DLL")> _ Private Shared Function GetStockObject(ByVal fnObject As Integer) As IntPtr End Function Public Sub FromHfont_Example(ByVal e As PaintEventArgs) ' Get a handle for a GDI font. Dim hFont As IntPtr = GetStockObject(0) ' Create a Font object from hFont. Dim hfontFont As Font = Font.FromHfont(hFont) ' Use hfontFont to draw text to the screen. e.Graphics.DrawString("This font is from a GDI HFONT", hfontFont, _ Brushes.Black, 0, 0) End Sub
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")] private static extern IntPtr GetStockObject(int fnObject); public void FromHfont_Example(PaintEventArgs e) { // Get a handle for a GDI font. IntPtr hFont = GetStockObject(0); // Create a Font object from hFont. Font hfontFont = Font.FromHfont(hFont); // Use hfontFont to draw text to the screen. e.Graphics.DrawString( "This font is from a GDI HFONT", hfontFont,Brushes.Black, 0, 0); }
private: [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] static IntPtr GetStockObject( int fnObject ); public: void FromHfont_Example( PaintEventArgs^ e ) { // Get a handle for a GDI font. IntPtr hFont = GetStockObject( 0 ); // Create a Font object from hFont. System::Drawing::Font^ hfontFont = System::Drawing::Font::FromHfont( hFont ); // Use hfontFont to draw text to the screen. e->Graphics->DrawString( "This font is from a GDI HFONT", hfontFont, Brushes::Black, 0, 0 ); }
/** @attribute System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll") */ private static native IntPtr GetStockObject(int fnObject); public void FromHfont_Example(PaintEventArgs e) { // Get a handle for a GDI font. IntPtr hFont = GetStockObject(0); // Create a Font object from hFont. Font hfontFont = Font.FromHfont(hFont); // Use hfontFont to draw text to the screen. e.get_Graphics().DrawString("This font is from a GDI HFONT", hfontFont , Brushes.get_Black(), 0, 0); } //FromHfont_Example


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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

- Font.FromHfont メソッドのページへのリンク