InkDrawingAttributesPencilProperties クラス

定義

InkCanvas で鉛筆ストロークをレンダリングするための一連の静的 InkDrawingAttributes プロパティを提供します。

InkDrawingAttributes.CreateForPencil を呼び出し、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
継承
Object Platform::Object IInspectable InkDrawingAttributesPencilProperties
属性

Windows の要件

デバイス ファミリ
Windows 10 Anniversary Edition (10.0.14393.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v3.0 で導入)

この例では、鉛筆属性を使用してインク ストロークをレンダリングする方法を示します。

まず、XAML で InkCanvas を 宣言します。

分離コードでは、鉛筆ストローク属性を SetPencilInkStyle() 指定する関数を定義します。

<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);
  }
}

注釈

既定では、鉛筆は円のペンヒントを使用して、ソフトエッジ、テクスチャ、半透明のストローク (レイヤード シェーディング効果に役立ちます) を描画します。 ストロークの色 (濃さ) は、感知された筆圧に依存します。

プロパティ

Opacity

InkCanvas で鉛筆ストロークをレンダリングするために使用される透過性のレベルを取得または設定します。

Opacity は InkDrawingAttributes の静的プロパティです。

InkDrawingAttributes.CreateForPencil を呼び出し、InkDrawingAttributes.PencilProperties にアクセスして、このクラスのインスタンスを取得します。

適用対象

こちらもご覧ください