GraphicsUnit 列挙体とは? わかりやすく解説

GraphicsUnit 列挙体

指定データ長さの単位指定します

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

public enum GraphicsUnit
public enum class GraphicsUnit
public enum GraphicsUnit
public enum GraphicsUnit
メンバメンバ
使用例使用例

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翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「GraphicsUnit 列挙体」の関連用語

GraphicsUnit 列挙体のお隣キーワード
検索ランキング

   

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



GraphicsUnit 列挙体のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS