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+는 미리 정의된 여러 캡 스타일을 지원하며 사용자가 자신의 캡 스타일을 정의할 수도 있습니다. 이 클래스는 사용자 지정 캡 스타일을 만드는 데 사용됩니다.

참고

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

생성자

CustomLineCap(GraphicsPath, GraphicsPath)

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

CustomLineCap(GraphicsPath, GraphicsPath, LineCap)

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

CustomLineCap(GraphicsPath, GraphicsPath, LineCap, Single)

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

속성

BaseCap

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

BaseInset

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

StrokeJoin

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

WidthScale

CustomLineCap 개체의 너비에 비례해서 이 Pen 클래스 개체에 지정할 배율을 가져오거나 설정합니다.

메서드

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)

적용 대상