CustomLineCap.Clone 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 CustomLineCap의 정확한 복사본을 만듭니다.
public:
virtual System::Object ^ Clone();
public object Clone ();
abstract member Clone : unit -> obj
override this.Clone : unit -> obj
Public Function Clone () As Object
반환
이 메서드가 개체로 만들어 캐스팅하는 CustomLineCap를 반환합니다.
구현
예제
다음 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 개체인 가 Paint 필요합니다PaintEventArgse
. 코드는 다음 작업을 수행합니다.
개체를 사용하여 사용자 지정 줄 한도를 GraphicsPath 만듭니다.
방금 만든 개체를 CustomLineCap 사용하여 개체
firstCap
를 GraphicsPath 만듭니다.메서드를 사용하여 의
firstCap
복제본을 Clone 만듭니다.개체의 CustomStartCapPen 및 CustomEndCap 속성을 설정하고 해당 펜을 사용하여 화면에 선과 사용자 지정 대문자를 그립니다.
Public Sub CloneExample(e As PaintEventArgs)
Dim points As Point() = New Point(- 5, - 5) New Point(0, 0) _
New Point(5, - 5)
Dim capPath As New GraphicsPath()
' Create a Path and add two lines to it,
' forming a custom line cap.
capPath.AddLines(points)
' Create a CustomLineCap object.
Dim firstCap As New CustomLineCap(Nothing, capPath)
' Create a copy of firstCap.
Dim secondCap As CustomLineCap = CType(firstCap.Clone(), _
CustomLineCap)
' Create a Pen object.
Dim pen As New Pen(Color.Black, 3F)
'Set up the line.
Dim point1 As New Point(20, 20)
Dim point2 As New Point(100, 100)
' Set up the caps.
pen.CustomStartCap = firstCap
pen.CustomEndCap = secondCap
' Draw the line and caps to the screen.
e.Graphics.DrawLine(pen, point1, point2)
End Sub
private void CloneExample(PaintEventArgs e)
{
// Create a Path and add two lines to it,
// forming a custom line cap.
Point[] points =
{
new Point(-5, -5),
new Point(0, 0),
new Point(5, -5)
};
GraphicsPath capPath = new GraphicsPath();
capPath.AddLines(points);
// Create a CustomLineCap object.
CustomLineCap firstCap = new CustomLineCap(null, capPath);
// Create a copy of firstCap.
CustomLineCap secondCap = (CustomLineCap)firstCap.Clone();
// Create a Pen object.
Pen pen = new Pen(Color.Black, 3.0f);
// Set up the line.
Point point1 = new Point(20, 20);
Point point2 = new Point(100, 100);
// Set up the caps.
pen.CustomStartCap = firstCap;
pen.CustomEndCap = secondCap;
// Draw the line and caps to the screen.
e.Graphics.DrawLine(pen, point1, point2);
}
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기