DrawingAttributes 클래스

정의

Stroke의 모양을 지정합니다.

public ref class DrawingAttributes : System::ComponentModel::INotifyPropertyChanged
public class DrawingAttributes : System.ComponentModel.INotifyPropertyChanged
type DrawingAttributes = class
    interface INotifyPropertyChanged
Public Class DrawingAttributes
Implements INotifyPropertyChanged
상속
DrawingAttributes
구현

예제

다음 예제에서는 두 개 사용 하는 방법을 보여 줍니다 DrawingAttributes 펜과 형광펜을 사용 하 여 동일한 시뮬레이션 개체 InkCanvas합니다. 이 예제에서는 XAML 파일의 루트 요소는 가정를 DockPanel 호출 root합니다. 수도 있다고 가정를 Button 호출 switchHighlighter 하 고는 Click 이 예제에서 정의 된 이벤트 처리기에 연결 된 이벤트입니다.

InkCanvas inkCanvas1 = new InkCanvas();
DrawingAttributes inkDA;
DrawingAttributes highlighterDA;
bool useHighlighter = false;

// Add an InkCanvas to the window, and allow the user to 
// switch between using a green pen and a purple highlighter 
// on the InkCanvas.
private void WindowLoaded(object sender, EventArgs e)
{
    inkCanvas1.Background = Brushes.DarkSlateBlue;
    inkCanvas1.DefaultDrawingAttributes.Color = Colors.SpringGreen;

    root.Children.Add(inkCanvas1);

    // Set up the DrawingAttributes for the pen.
    inkDA = new DrawingAttributes();
    inkDA.Color = Colors.SpringGreen;
    inkDA.Height = 5;
    inkDA.Width = 5;
    inkDA.FitToCurve = false;

    // Set up the DrawingAttributes for the highlighter.
    highlighterDA = new DrawingAttributes();
    highlighterDA.Color = Colors.Orchid;
    highlighterDA.IsHighlighter = true;
    highlighterDA.IgnorePressure = true;
    highlighterDA.StylusTip = StylusTip.Rectangle;
    highlighterDA.Height = 30;
    highlighterDA.Width = 10;

    inkCanvas1.DefaultDrawingAttributes = inkDA;
}

// Create a button called switchHighlighter and use 
// SwitchHighlighter_Click to handle the Click event.  
// The useHighlighter variable is a boolean that indicates
// whether the InkCanvas renders ink as a highlighter.

// Switch between using the 'pen' DrawingAttributes and the 
// 'highlighter' DrawingAttributes.
void SwitchHighlighter_Click(Object sender, RoutedEventArgs e)
{
    useHighlighter = !useHighlighter;
    
    if (useHighlighter)
    {
        switchHighlighter.Content = "Use Pen";
        inkCanvas1.DefaultDrawingAttributes = highlighterDA;
    }
    else
    {
        switchHighlighter.Content = "Use Highlighter";
        inkCanvas1.DefaultDrawingAttributes = inkDA;
    }
}
Private WithEvents inkCanvas1 As New InkCanvas()
Private inkDA As DrawingAttributes
Private highlighterDA As DrawingAttributes
Private useHighlighter As Boolean = False

' Add an InkCanvas to the window, and allow the user to 
' switch between using a green pen and a purple highlighter 
' on the InkCanvas.
Private Sub WindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)

    inkCanvas1.Background = Brushes.DarkSlateBlue
    inkCanvas1.DefaultDrawingAttributes.Color = Colors.SpringGreen

    ' Add the InkCanvas to the DockPanel, named root.
    root.Children.Add(inkCanvas1)

    ' Set up the DrawingAttributes for the pen.
    inkDA = New DrawingAttributes()
    With inkDA
        .Color = Colors.SpringGreen
        .Height = 5
        .Width = 5
        .FitToCurve = True
    End With

    ' Set up the DrawingAttributes for the highlighter.
    highlighterDA = New DrawingAttributes()
    With highlighterDA
        .Color = Colors.Orchid
        .IsHighlighter = True
        .IgnorePressure = True
        .StylusTip = StylusTip.Rectangle
        .Height = 30
        .Width = 10
    End With

    inkCanvas1.DefaultDrawingAttributes = inkDA

End Sub


' Create a button called switchHighlighter and use 
' SwitchHighlighter_Click to handle the Click event.  
' The useHighlighter variable is a boolean that indicates
' whether the InkCanvas renders ink as a highlighter.

' Switch between using the 'pen' DrawingAttributes and the 
' 'highlighter' DrawingAttributes when the user clicks on .
Private Sub SwitchHighlighter_Click(ByVal sender As [Object], ByVal e As RoutedEventArgs)

    useHighlighter = Not useHighlighter

    If useHighlighter Then
        switchHighlighter.Content = "Use Pen"
        inkCanvas1.DefaultDrawingAttributes = highlighterDA
    Else

        switchHighlighter.Content = "Use Highlighter"
        inkCanvas1.DefaultDrawingAttributes = inkDA
    End If

End Sub

설명

사용 된 DrawingAttributes 색, 너비, 투명성 및 모양의 스타일러스 끝 등의 설정을 지정 하는 속성을 Stroke.

사용 합니다 DefaultDrawingAttributes 추가할 스트로크에 대 한 그리기 특성을 지정 하는 속성을 InkCanvas입니다. 뒤에 추가 되는 유일한 스트로크는 DefaultDrawingAttributes 변경 표시 업데이트 된 특성을 진행 합니다. 에 이미 있는 스트로크의 모양을 InkCanvas 변경 되지 않습니다.

DrawingAttributes 클래스의 인스턴스에 대한 초기 속성 값 목록은 DrawingAttributes 생성자를 참조하십시오.

XAML 텍스트 사용

이 클래스는 XAML에서 일반적으로 사용 되지 않습니다.

생성자

DrawingAttributes()

DrawingAttributes 클래스의 새 인스턴스를 초기화합니다.

필드

MaxHeight

Height 속성에 허용되는 가장 큰 값을 지정합니다.

MaxWidth

Width 속성에 허용되는 가장 큰 값을 지정합니다.

MinHeight

Height 속성에 허용되는 가장 작은 값을 지정합니다.

MinWidth

Width 속성에 허용되는 가장 작은 값을 지정합니다.

속성

Color

Stroke의 색을 가져오거나 설정합니다.

FitToCurve

Stroke를 렌더링하는 데 베지어 다듬기가 사용되는지 여부를 나타내는 값을 가져오거나 설정합니다.

Height

Stroke를 그리는 데 사용된 스타일러스의 높이를 가져오거나 설정합니다.

IgnorePressure

렌더링된 Stroke의 두께가 적용된 압력에 따라 변경되는지 여부를 나타내는 값을 가져오거나 설정합니다.

IsHighlighter

Stroke가 형광펜 모양인지 여부를 나타내는 값을 가져오거나 설정합니다.

StylusTip

Stroke를 그리는 데 사용된 스타일러스의 모양을 가져오거나 설정합니다.

StylusTipTransform

스타일러스의 끝에서 수행할 변환을 지정하는 Matrix를 가져오거나 설정합니다.

Width

Stroke를 그리는 데 사용된 스타일러스의 너비를 가져오거나 설정합니다.

메서드

AddPropertyData(Guid, Object)

DrawingAttributes 개체에 사용자 지정 속성을 추가합니다.

Clone()

DrawingAttributes 개체를 복사합니다.

ContainsPropertyData(Guid)

지정한 속성 데이터 ID가 DrawingAttributes 개체에 있는지 여부를 나타내는 값을 반환합니다.

Equals(Object)

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

GetHashCode()

특정 유형에 대한 해시 함수로 사용합니다.

GetPropertyData(Guid)

지정한 Guid와 연결된 사용자 지정 속성의 값을 가져옵니다.

GetPropertyDataIds()

StrokeCollection과 연결된 사용자 지정 속성의 GUID를 반환합니다.

GetType()

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

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

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

(다음에서 상속됨 Object)
OnAttributeChanged(PropertyDataChangedEventArgs)

AttributeChanged 이벤트를 발생시킵니다.

OnPropertyChanged(PropertyChangedEventArgs)

DrawingAttributes 속성이 변경될 때 발생합니다.

OnPropertyDataChanged(PropertyDataChangedEventArgs)

PropertyDataChanged 이벤트를 발생시킵니다.

RemovePropertyData(Guid)

지정한 Guid와 연결된 사용자 지정 속성을 제거합니다.

ToString()

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

(다음에서 상속됨 Object)

연산자

Equality(DrawingAttributes, DrawingAttributes)

지정한 DrawingAttributes 개체가 동일한지 여부를 확인합니다.

Inequality(DrawingAttributes, DrawingAttributes)

지정한 두 DrawingAttributes 개체가 동일하지 않은지 여부를 확인합니다.

이벤트

AttributeChanged

DrawingAttributes 개체의 속성이 변경될 때 발생합니다.

PropertyDataChanged

속성 데이터가 StrokeCollection에서 추가되거나 제거될 때 발생합니다.

명시적 인터페이스 구현

INotifyPropertyChanged.PropertyChanged

이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다.

DrawingAttributes 속성 값이 변경되면 발생합니다.

적용 대상