InkDrawingAttributesPencilProperties Clase

Definición

Proporciona un conjunto de propiedades InkDrawingAttributes estáticas para representar un trazo de lápiz en inkCanvas.

Obtenga una instancia de esta clase llamando a InkDrawingAttributes.CreateForPencil y accediendo a InkDrawingAttributes.PencilProperties.

public ref class InkDrawingAttributesPencilProperties sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class InkDrawingAttributesPencilProperties final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InkDrawingAttributesPencilProperties
Public NotInheritable Class InkDrawingAttributesPencilProperties
Herencia
Object Platform::Object IInspectable InkDrawingAttributesPencilProperties
Atributos

Requisitos de Windows

Familia de dispositivos
Windows 10 Anniversary Edition (se introdujo en la versión 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (se introdujo en la versión v3.0)

Ejemplos

En este ejemplo se muestra cómo representar un trazo de lápiz mediante atributos de lápiz.

En primer lugar, declaramos InkCanvas en XAML.

En el código subyacente, definimos una SetPencilInkStyle() función para especificar los atributos de trazo de lápiz.

<InkCanvas x:Name="inkCanvas"/>
public sealed partial class Sample : Page
{
  public SetPencilInkStyle()
  {
    // Initialize the pencil stroke attributes.
    InkDrawingAttributes pencilAttributes = InkDrawingAttributes.CreateForPencil();
    pencilAttributes.Color = Windows.UI.Colors.Red;
    pencilAttributes.Size = new Windows.Foundation.Size(3, 3);
    Debug.Assert(attributes.Kind == InkDrawingAttributesKind.Pencil);
    pencilAttributes.PencilProperties.Opacity = 0.5f;
    // Update InkPresenter with the pencil attributes.
    inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(pencilAttributes);
  }
}
struct MainPage : MainPageT<MainPage>
{
    void SetPencilInkStyle()
    {
        // Initialize the pencil stroke attributes.
        auto pencilAttributes{ Windows::UI::Input::Inking::InkDrawingAttributes::CreateForPencil() };
        pencilAttributes.Color(Windows::UI::Colors::Red());
        pencilAttributes.Size({ 3, 3 });
        WINRT_ASSERT(pencilAttributes.Kind() == Windows::UI::Input::Inking::InkDrawingAttributesKind::Pencil);
        pencilAttributes.PencilProperties().Opacity(.5f);
        // Update the InkPresenter with the pencil attributes.
        m_inkCanvas.InkPresenter().UpdateDefaultDrawingAttributes(pencilAttributes);
    }
}
public sealed partial class Sample : Page
{
  public SetPencilInkStyle()
  {
    // Initialize the pencil stroke attributes.
    InkDrawingAttributes^ pencilAttributes = InkDrawingAttributes::CreateForPencil();
    pencilAttributes->Color = Windows::UI::Colors::Red;
    pencilAttributes->Size = Windows::Foundation::Size(3, 3);
    assert(pencilAttributes->Kind == InkDrawingAttributesKind::Pencil);
    pencilAttributes->PencilProperties->Opacity = 0.5f;
    // Update the InkPresenter with the pencil attributes.
    inkCanvas->InkPresenter->UpdateDefaultDrawingAttributes(pencilAttributes);
  }
}

Comentarios

De forma predeterminada, un lápiz dibuja un trazo de borde suave, texturado y semitransparente (útil para efectos de sombreado superpuestas) con una información sobre círculos. El color del trazo (oscuridad) depende de la presión del lápiz que se detecte.

Propiedades

Opacity

Obtiene o establece el nivel de transparencia utilizado para representar un trazo de lápiz en un inkCanvas.

Opacity es una propiedad estática de InkDrawingAttributes.

Obtenga una instancia de esta clase llamando a InkDrawingAttributes.CreateForPencil y accediendo a InkDrawingAttributes.PencilProperties.

Se aplica a

Consulte también