CustomLineCap 클래스

정의

사용자 지정 사용자 정의 줄 바꿈을 캡슐화합니다.

public ref class CustomLineCap : MarshalByRefObject, ICloneable, IDisposable
public class CustomLineCap : MarshalByRefObject, ICloneable, IDisposable
type CustomLineCap = class
    inherit MarshalByRefObject
    interface ICloneable
    interface IDisposable
Public Class CustomLineCap
Inherits MarshalByRefObject
Implements ICloneable, IDisposable
상속
CustomLineCap
파생
구현

예제

다음 예제에서는 클래스를 사용하는 방법을 보여 줍니다 CustomLineCap . 이 예제를 실행하려면 코드를 Windows Form에 붙여넣습니다. 양식의 Paint 이벤트를 처리하고 양식의 Paint 이벤트 처리 메서드에서 호출 DrawCaps 하여 다음으로 PaintEventArgs전달 e 합니다.


protected void DrawCaps(PaintEventArgs e)
{
    GraphicsPath hPath = new GraphicsPath();

    // Create the outline for our custom end cap.
    hPath.AddLine(new Point(0, 0), new Point(0, 5));
    hPath.AddLine(new Point(0, 5), new Point(5, 1));
    hPath.AddLine(new Point(5, 1), new Point(3, 1));

    // Construct the hook-shaped end cap.
    CustomLineCap HookCap = new CustomLineCap(null, hPath);

    // Set the start cap and end cap of the HookCap to be rounded.
    HookCap.SetStrokeCaps(LineCap.Round, LineCap.Round);

    // Create a pen and set end custom start and end
    // caps to the hook cap.
    Pen customCapPen = new Pen(Color.Black, 5);
    customCapPen.CustomStartCap = HookCap;
    customCapPen.CustomEndCap = HookCap;

    // Create a second pen using the start and end caps from
    // the hook cap.
    Pen capPen = new Pen(Color.Red, 10);
    LineCap startCap;
    LineCap endCap;
    HookCap.GetStrokeCaps(out startCap, out endCap);
    capPen.StartCap = startCap;
    capPen.EndCap = endCap;

    // Create a line to draw.
    Point[] points = { new Point(100, 100), new Point(200, 50), 
        new Point(250, 300) };

    // Draw the lines.
    e.Graphics.DrawLines(capPen, points);
    e.Graphics.DrawLines(customCapPen, points);
}
Protected Sub DrawCaps(ByVal e As PaintEventArgs)
    Dim hPath As New GraphicsPath()

    ' Create the outline for our custom end cap.
    hPath.AddLine(New Point(0, 0), New Point(0, 5))
    hPath.AddLine(New Point(0, 5), New Point(5, 1))
    hPath.AddLine(New Point(5, 1), New Point(3, 1))

    ' Construct the hook-shaped end cap.
    Dim HookCap As New CustomLineCap(Nothing, hPath)

    ' Set the start cap and end cap of the HookCap to be rounded.
    HookCap.SetStrokeCaps(LineCap.Round, LineCap.Round)

    ' Create a pen and set end custom start and end
    ' caps to the hook cap.
    Dim customCapPen As New Pen(Color.Black, 5)
    customCapPen.CustomStartCap = HookCap
    customCapPen.CustomEndCap = HookCap

    ' Create a second pen using the start and end caps from
    ' the hook cap.
    Dim capPen As New Pen(Color.Red, 10)
    Dim startCap As LineCap
    Dim endCap As LineCap
    HookCap.GetStrokeCaps(startCap, endCap)
    capPen.StartCap = startCap
    capPen.EndCap = endCap

    ' Create a line to draw.
    Dim points As Point() = {New Point(100, 100), New Point(200, 50), _
        New Point(250, 300)}

    ' Draw the lines.
    e.Graphics.DrawLines(capPen, points)
    e.Graphics.DrawLines(customCapPen, points)

End Sub

설명

선 대문자는 GDI+ Pen 개체에서 그린 선 또는 곡선의 시작과 끝에 사용됩니다. GDI+는 몇 가지 미리 정의된 캡 스타일을 지원하며 사용자가 자체 캡 스타일을 정의할 수도 있습니다. 이 클래스는 사용자 지정 캡 스타일을 만드는 데 사용됩니다.

Note

.NET 6 이상 버전에서는 이 형식을 포함하는 System.Drawing.Common 패키지가 Windows 운영 체제에서만 지원됩니다. 플랫폼 간 앱에서 이 형식을 사용하면 컴파일 시간 경고 및 런타임 예외가 발생합니다. 자세한 내용은 Windows에서만 지원되는 System.Drawing.Common을 참조 하세요.

생성자

Name Description
CustomLineCap(GraphicsPath, GraphicsPath, LineCap, Single)

지정된 윤곽선, 채우기 및 삽입을 사용하여 지정된 기존 LineCap 열거형에서 클래스의 새 인스턴스 CustomLineCap 를 초기화합니다.

CustomLineCap(GraphicsPath, GraphicsPath, LineCap)

지정된 윤곽선과 채우기를 사용하여 지정된 기존 LineCap 열거형에서 클래스의 새 인스턴스 CustomLineCap 를 초기화합니다.

CustomLineCap(GraphicsPath, GraphicsPath)

지정된 윤곽선과 채우기를 CustomLineCap 사용하여 클래스의 새 인스턴스를 초기화합니다.

속성

Name Description
BaseCap

CustomLineCap 기준이 LineCap 되는 열거형을 가져오거나 설정합니다.

BaseInset

캡과 선 사이의 거리를 가져오거나 설정합니다.

StrokeJoin

CustomLineCap 개체를 LineJoin 구성하는 선이 조인되는 방법을 결정하는 열거형을 가져오거나 설정합니다.

WidthScale

개체의 너비와 관련하여 이 CustomLineCap Class 개체의 Pen 크기를 조정할 크기를 가져오거나 설정합니다.

메서드

Name Description
Clone()

정확한 복사본 CustomLineCap을 만듭니다.

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시를 생성하는 데 필요한 모든 관련 정보를 포함하는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Dispose()

CustomLineCap 개체에서 사용하는 모든 리소스를 해제합니다.

Dispose(Boolean)

관리되지 않는 리소스를 CustomLineCap 해제하고 관리되는 리소스를 선택적으로 해제합니다.

Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.

(다음에서 상속됨 Object)
Finalize()

가비 CustomLineCap 지 수집에서 리소스를 회수하기 전에 CustomLineCap 리소스를 해제하고 다른 정리 작업을 수행할 수 있습니다.

GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()

이 인스턴스의 수명 정책을 제어하는 현재 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetStrokeCaps(LineCap, LineCap)

이 사용자 지정 캡을 구성하는 시작 및 끝 줄에 사용되는 대문자를 가져옵니다.

GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
InitializeLifetimeService()

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
SetStrokeCaps(LineCap, LineCap)

이 사용자 지정 캡을 구성하는 시작 및 끝 줄에 사용되는 캡을 설정합니다.

ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상