GraphicsUnit 列挙体
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Enumeration GraphicsUnit

メンバ名 | 説明 | |
---|---|---|
Display | 表示デバイスの長さの単位を指定します。通常、ビデオ ディスプレイにはピクセル、プリンタには 1/100 インチを指定します。 | |
Document | ドキュメント単位 (1/300 インチ) を長さの単位に指定します。 | |
Inch | インチを長さの単位に指定します。 | |
Millimeter | ミリメートルを長さの単位に指定します。 | |
![]() | Pixel | デバイス ピクセルを長さの単位に指定します。 |
Point | プリンタ ポイント (1/72 インチ) を長さの単位に指定します。 | |
World | ワールド座標系を長さの単位に指定します。 |

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

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に収録されているすべての辞書からGraphicsUnit 列挙体を検索する場合は、下記のリンクをクリックしてください。

- GraphicsUnit 列挙体のページへのリンク