Icon.Handle プロパティとは? わかりやすく解説

Icon.Handle プロパティ

この IconWindows ハンドル取得します。これはハンドルコピーではありません。解放しないください

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

使用例使用例

GraphicsUnit 列挙体を使用してビットマップIcon ハンドルから読み込む方法と、Round メソッド使用してビットマップ外接する四角形描画する方法次のコード例示します

この例は、Windows フォームでの使用意図してデザインされています。Button2 という名前のボタン格納するフォーム作成しますコードフォーム貼り付け、このメソッドボタンClick イベント関連付けます。

Private Sub Button2_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 Button2.Click

    Dim bitmap1 As Bitmap = Bitmap.FromHicon(SystemIcons.Hand.Handle)
    Dim formGraphics As Graphics = Me.CreateGraphics()
    Dim units As GraphicsUnit = GraphicsUnit.Point
    Dim bmpRectangleF As RectangleF = bitmap1.GetBounds(units)
    Dim bmpRectangle As Rectangle = Rectangle.Round(bmpRectangleF)
    formGraphics.DrawRectangle(Pens.Blue, bmpRectangle)
    formGraphics.Dispose()
End Sub
private void Button2_Click(System.Object sender,
 System.EventArgs e)
{

    Bitmap bitmap1 = Bitmap.FromHicon(SystemIcons.Hand.Handle);
    Graphics formGraphics = this.CreateGraphics();
    GraphicsUnit units = GraphicsUnit.Point;

    RectangleF bmpRectangleF = bitmap1.GetBounds(ref units);
    Rectangle bmpRectangle = Rectangle.Round(bmpRectangleF);
    formGraphics.DrawRectangle(Pens.Blue, bmpRectangle);
    formGraphics.Dispose();
}
void Button2_Click( System::Object^ /*sender*/, System::EventArgs^
 /*e*/ )
{
   Bitmap^ bitmap1 = Bitmap::FromHicon( SystemIcons::Hand->Handle );
   Graphics^ formGraphics = this->CreateGraphics();
   GraphicsUnit units = GraphicsUnit::Point;
   RectangleF bmpRectangleF = bitmap1->GetBounds( units );
   Rectangle bmpRectangle = Rectangle::Round( bmpRectangleF );
   formGraphics->DrawRectangle( Pens::Blue, bmpRectangle );
   delete formGraphics;
}
private void button2_Click(System.Object sender,
 System.EventArgs e)
{
    Bitmap bitmap1 = Bitmap.FromHicon(SystemIcons.get_Hand().get_Handle());
    Graphics formGraphics = this.CreateGraphics();
    GraphicsUnit units = GraphicsUnit.Point;
    RectangleF bmpRectangleF = bitmap1.GetBounds(units);
    Rectangle bmpRectangle = Rectangle.Round(bmpRectangleF);

    formGraphics.DrawRectangle(Pens.get_Blue(), bmpRectangle);
    formGraphics.Dispose();
} //button2_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

「Icon.Handle プロパティ」の関連用語

Icon.Handle プロパティのお隣キーワード
検索ランキング

   

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



Icon.Handle プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS