GraphicsPath.GetBounds 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 GraphicsPath를 제한하는 사각형을 반환합니다.
오버로드
GetBounds() |
이 GraphicsPath를 제한하는 사각형을 반환합니다. |
GetBounds(Matrix) |
지정된 GraphicsPath에 의해 이 경로가 변환되면 이 Matrix를 제한하는 사각형을 반환합니다. |
GetBounds(Matrix, Pen) |
현재 경로가 지정된 GraphicsPath에 의해 변환되고 지정된 Matrix를 사용하여 그려지는 경우 이 Pen를 제한하는 사각형을 반환합니다. |
GetBounds()
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
이 GraphicsPath를 제한하는 사각형을 반환합니다.
public:
System::Drawing::RectangleF GetBounds();
public System.Drawing.RectangleF GetBounds ();
member this.GetBounds : unit -> System.Drawing.RectangleF
Public Function GetBounds () As RectangleF
반환
이 RectangleF를 제한하는 사각형을 나타내는 GraphicsPath입니다.
예제
다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 가 OnPaint 필요합니다PaintEventArgse
. 코드는 다음 작업을 수행합니다.
그래픽 경로를 만듭니다.
타원(원)을 추가하고 화면에 그립니다.
를 호출 GetBounds 하여 원의 경계 사각형을 검색하고 사각형을 화면에 그립니다.
두 번째 그래픽 경로를 만듭니다.
원을 추가하고 경로를 너비 10으로 확장합니다.
화면의 경로를 그립니다.
두 번째 원의 경계 사각형을 검색합니다.
경계 사각형을 화면에 그립니다.
대화 상자에 사각형 크기를 표시합니다.
오른쪽의 경계 사각형이 더 큽니다(선의 추가 너비를 고려).
public:
void GetBoundsExample( PaintEventArgs^ e )
{
// Create path number 1 and a Pen for drawing.
GraphicsPath^ myPath = gcnew GraphicsPath;
Pen^ pathPen = gcnew Pen( Color::Black,1.0f );
// Add an Ellipse to the path and Draw it (circle in start
// position).
myPath->AddEllipse( 20, 20, 100, 100 );
e->Graphics->DrawPath( pathPen, myPath );
// Get the path bounds for Path number 1 and draw them.
RectangleF boundRect = myPath->GetBounds();
e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), boundRect.X, boundRect.Y, boundRect.Height, boundRect.Width );
// Create a second graphics path and a wider Pen.
GraphicsPath^ myPath2 = gcnew GraphicsPath;
Pen^ pathPen2 = gcnew Pen( Color::Black,10.0f );
// Create a new ellipse with a width of 10.
myPath2->AddEllipse( 150, 20, 100, 100 );
myPath2->Widen( pathPen2 );
e->Graphics->FillPath( Brushes::Black, myPath2 );
// Get the second path bounds.
RectangleF boundRect2 = myPath2->GetBounds();
// Draw the bounding rectangle.
e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), boundRect2.X, boundRect2.Y, boundRect2.Height, boundRect2.Width );
// Display the rectangle size.
MessageBox::Show( boundRect2.ToString() );
}
public void GetBoundsExample(PaintEventArgs e)
{
// Create path number 1 and a Pen for drawing.
GraphicsPath myPath = new GraphicsPath();
Pen pathPen = new Pen(Color.Black, 1);
// Add an Ellipse to the path and Draw it (circle in start
// position).
myPath.AddEllipse(20, 20, 100, 100);
e.Graphics.DrawPath(pathPen, myPath);
// Get the path bounds for Path number 1 and draw them.
RectangleF boundRect = myPath.GetBounds();
e.Graphics.DrawRectangle(new Pen(Color.Red, 1),
boundRect.X,
boundRect.Y,
boundRect.Height,
boundRect.Width);
// Create a second graphics path and a wider Pen.
GraphicsPath myPath2 = new GraphicsPath();
Pen pathPen2 = new Pen(Color.Black, 10);
// Create a new ellipse with a width of 10.
myPath2.AddEllipse(150, 20, 100, 100);
myPath2.Widen(pathPen2);
e.Graphics.FillPath(Brushes.Black, myPath2);
// Get the second path bounds.
RectangleF boundRect2 = myPath2.GetBounds();
// Draw the bounding rectangle.
e.Graphics.DrawRectangle(new Pen(Color.Red, 1),
boundRect2.X,
boundRect2.Y,
boundRect2.Height,
boundRect2.Width);
// Display the rectangle size.
MessageBox.Show(boundRect2.ToString());
}
Public Sub GetBoundsExample(ByVal e As PaintEventArgs)
' Create path number 1 and a Pen for drawing.
Dim myPath As New GraphicsPath
Dim pathPen As New Pen(Color.Black, 1)
' Add an Ellipse to the path and Draw it (circle in start
' position).
myPath.AddEllipse(20, 20, 100, 100)
e.Graphics.DrawPath(pathPen, myPath)
' Get the path bounds for Path number 1 and draw them.
Dim boundRect As RectangleF = myPath.GetBounds()
e.Graphics.DrawRectangle(New Pen(Color.Red, 1), boundRect.X, _
boundRect.Y, boundRect.Height, boundRect.Width)
' Create a second graphics path and a wider Pen.
Dim myPath2 As New GraphicsPath
Dim pathPen2 As New Pen(Color.Black, 10)
' Create a new ellipse with a width of 10.
myPath2.AddEllipse(150, 20, 100, 100)
myPath2.Widen(pathPen2)
e.Graphics.FillPath(Brushes.Black, myPath2)
' Get the second path bounds.
Dim boundRect2 As RectangleF = myPath2.GetBounds()
' Show the bounds in a message box.
e.Graphics.DrawString("Rectangle2 Bounds: " + _
boundRect2.ToString(), New Font("Arial", 8), Brushes.Black, _
20, 150)
' Draw the bounding rectangle.
e.Graphics.DrawRectangle(New Pen(Color.Red, 1), boundRect2.X, _
boundRect2.Y, boundRect2.Height, boundRect2.Width)
End Sub
설명
반환된 경계 사각형의 크기는 끝 대문자, 펜 너비 및 펜 마이터 제한의 형식에 따라 영향을 받으므로 제한된 경로에 "느슨한 맞춤"을 생성합니다. 대략적인 수식은 : 초기 경계 사각형은 펜 너비로 팽창하고,이 결과는 미터 제한과 끝 대문자를 허용하기 위해 몇 가지 추가 여백을 곱합니다.
적용 대상
GetBounds(Matrix)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
지정된 GraphicsPath에 의해 이 경로가 변환되면 이 Matrix를 제한하는 사각형을 반환합니다.
public:
System::Drawing::RectangleF GetBounds(System::Drawing::Drawing2D::Matrix ^ matrix);
public System.Drawing.RectangleF GetBounds (System.Drawing.Drawing2D.Matrix matrix);
public System.Drawing.RectangleF GetBounds (System.Drawing.Drawing2D.Matrix? matrix);
member this.GetBounds : System.Drawing.Drawing2D.Matrix -> System.Drawing.RectangleF
Public Function GetBounds (matrix As Matrix) As RectangleF
매개 변수
- matrix
- Matrix
경계 사각형을 계산하기 전에 이 경로에 적용될 변환을 지정하는 Matrix입니다. 이 경로는 영구적으로 변환되는 것이 아니며, 경계 사각형을 계산하는 동안에만 이 경로에 변환이 사용됩니다.
반환
이 RectangleF를 제한하는 사각형을 나타내는 GraphicsPath입니다.
예제
예제를 보려면 GetBounds()를 참조하세요.
설명
반환된 경계 사각형의 크기는 끝 대문자, 펜 너비 및 펜 마이터 제한의 형식에 따라 영향을 받으므로 제한된 경로에 "느슨한 맞춤"을 생성합니다. 대략적인 수식은 : 초기 경계 사각형은 펜 너비로 팽창하고,이 결과는 미터 제한과 끝 대문자를 허용하기 위해 몇 가지 추가 여백을 곱합니다.
적용 대상
GetBounds(Matrix, Pen)
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
- Source:
- GraphicsPath.cs
현재 경로가 지정된 GraphicsPath에 의해 변환되고 지정된 Matrix를 사용하여 그려지는 경우 이 Pen를 제한하는 사각형을 반환합니다.
public:
System::Drawing::RectangleF GetBounds(System::Drawing::Drawing2D::Matrix ^ matrix, System::Drawing::Pen ^ pen);
public System.Drawing.RectangleF GetBounds (System.Drawing.Drawing2D.Matrix matrix, System.Drawing.Pen pen);
public System.Drawing.RectangleF GetBounds (System.Drawing.Drawing2D.Matrix? matrix, System.Drawing.Pen? pen);
member this.GetBounds : System.Drawing.Drawing2D.Matrix * System.Drawing.Pen -> System.Drawing.RectangleF
Public Function GetBounds (matrix As Matrix, pen As Pen) As RectangleF
매개 변수
- matrix
- Matrix
경계 사각형을 계산하기 전에 이 경로에 적용될 변환을 지정하는 Matrix입니다. 이 경로는 영구적으로 변환되는 것이 아니며, 경계 사각형을 계산하는 동안에만 이 경로에 변환이 사용됩니다.
- pen
- Pen
Pen를 그릴 GraphicsPath입니다.
반환
이 RectangleF를 제한하는 사각형을 나타내는 GraphicsPath입니다.
예제
예제를 보려면 GetBounds()를 참조하세요.
설명
반환된 경계 사각형의 크기는 끝 대문자, 펜 너비 및 펜 마이터 제한의 형식에 따라 영향을 받으므로 제한된 경로에 "느슨한 맞춤"을 생성합니다. 대략적인 수식은 : 초기 경계 사각형은 펜 너비로 팽창하고,이 결과는 미터 제한과 끝 대문자를 허용하기 위해 몇 가지 추가 여백을 곱합니다.
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기