GraphicsUnit 열거형

정의

주어진 데이터를 측정하는 단위를 지정합니다.

public enum class GraphicsUnit
public enum GraphicsUnit
type GraphicsUnit = 
Public Enum GraphicsUnit
상속
GraphicsUnit

필드

Display 1

디스플레이 디바이스의 측정 단위를 지정합니다. 일반적으로 비디오 디스플레이의 경우 픽셀이고 프린터의 경우 1/100인치입니다.

Document 5

1/300 인치의 문서 단위를 측정 단위로 지정합니다.

Inch 4

인치를 측정 단위로 지정합니다.

Millimeter 6

밀리미터를 측정 단위로 지정합니다.

Pixel 2

디바이스 픽셀을 측정 단위로 지정합니다.

Point 3

프린터의 점(1/72인치)을 측정 단위로 지정합니다.

World 0

영역 좌표계 단위를 측정 단위로 지정합니다.

예제

다음 코드 예제에서는 열거형을 사용하여 핸들에서 Icon 비트맵을 로드하는 방법과 메서드를 사용하여 GraphicsUnit 비트맵의 Round 사각형 범위를 그리는 방법을 보여 줍니다.

이 예제는 Windows Forms 사용하도록 설계되었습니다. Button2라는 단추가 포함된 양식을 만듭니다. 코드를 양식에 붙여넣고 이 메서드를 단추의 Click 이벤트와 연결합니다.

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.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();
}
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

적용 대상