Font.ToHfont メソッドとは? わかりやすく解説

Font.ToHfont メソッド

この Font識別するハンドル返します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Function ToHfont As
 IntPtr
Dim instance As Font
Dim returnValue As IntPtr

returnValue = instance.ToHfont
public IntPtr ToHfont ()
public:
IntPtr ToHfont ()
public IntPtr ToHfont ()
public function ToHfont () : IntPtr

戻り値
この Font識別する Windows ハンドル

例外例外
解説解説
使用例使用例

Font作成し、その Font識別するハンドル取得するコード例次に示します。この例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgse が必要です。

' Reference the DeleteObject method in the GDI library.
<System.Runtime.InteropServices.DllImportAttribute("GDI32.DLL")>
 _
Private Shared Function
 DeleteObject(ByVal objectHandle As IntPtr)
 As Boolean
End Function

Public Sub ToHfont_Example(ByVal
 e As PaintEventArgs)

    ' Create a Font object.
    Dim myFont As New Font("Arial",
 16)

    ' Get a handle to the Font object.
    Dim hFont As IntPtr = myFont.ToHfont()

    ' Display a message box with the value of hFont.
    MessageBox.Show(hFont.ToString())

    ' Dispose of the hFont.
    DeleteObject(hFont)
End Sub
//Reference the GDI DeleteObject method.
    [System.Runtime.InteropServices.DllImport("GDI32.dll")]
    public static extern bool
 DeleteObject(IntPtr objectHandle); 

    public void ToHfont_Example(PaintEventArgs
 e)
    {
        // Create a Font object.
        Font myFont = new Font("Arial", 16);
                 
        // Get a handle to the Font object.
        IntPtr hFont = myFont.ToHfont();
                 
        // Display a message box with the value of hFont.
        MessageBox.Show(hFont.ToString());
        
        //Dispose of the hFont.
        DeleteObject(hFont);
    }
   //Reference the GDI DeleteObject method.
public:
   [System::Runtime::InteropServices::DllImport("GDI32.dll")]
   static bool DeleteObject( IntPtr objectHandle
 );
   void ToHfont_Example( PaintEventArgs^ /*e*/ )
   {
      // Create a Font object.
      System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16
 );

      // Get a handle to the Font object.
      IntPtr hFont = myFont->ToHfont();

      // Display a message box with the value of hFont.
      MessageBox::Show( hFont.ToString() );

      //Dispose of the hFont.
      DeleteObject( hFont );
   }
//Reference the GDI DeleteObject method.
/** @attribute System.Runtime.InteropServices.DllImport("GDI32.dll")
 */
public static native boolean DeleteObject(IntPtr
 objectHandle);

public void ToHfont_Example(PaintEventArgs
 e)
{
    // Create a Font object.
    Font myFont = new Font("Arial", 16);

    // Get a handle to the Font object.
    IntPtr hFont = myFont.ToHfont();

    // Display a message box with the value of hFont.
    MessageBox.Show(hFont.ToString());

    //Dispose of the hFont.
    DeleteObject(hFont);
} //ToHfont_Example
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Font.ToHfont メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Font.ToHfont メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS