InkDrawingAttributesPencilProperties Kelas
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menyediakan satu set properti InkDrawingAttributes statis untuk merender goresan pensil pada InkCanvas.
Dapatkan instans kelas ini dengan memanggil InkDrawingAttributes.CreateForPencil dan mengakses 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
- Warisan
- Atribut
Persyaratan Windows
Rangkaian perangkat |
Windows 10 Anniversary Edition (diperkenalkan dalam 10.0.14393.0)
|
API contract |
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v3.0)
|
Contoh
Contoh ini menunjukkan cara merender goresan tinta menggunakan atribut pensil.
Pertama, kami mendeklarasikan InkCanvas di XAML.
Di kode belakang, kami mendefinisikan SetPencilInkStyle()
fungsi untuk menentukan atribut stroke pensil.
- Buat objek InkDrawingAttributes khusus melalui metode CreateForPencil .
- Atur beberapa atribut goresan umum, seperti Warna dan Ukuran.
- Jika InkDrawingAttributesKind adalah Pencil, atur atribut Opacity .
- Panggil UpdateDefaultDrawingAttributes untuk mengatur InkDrawingAttributes yang digunakan oleh InkPresenter saat merender InkStroke baru pada kontrol InkCanvas .
<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);
}
}
Keterangan
Secara default, pensil menggambar goresan bermata lembut, bertekskus, dan semi transparan (berguna untuk efek bayangan berlapis) dengan PenTip Lingkaran. Warna goresan (kegelapan) tergantung pada tekanan pena yang terdeteksi.
Properti
Opacity |
Mendapatkan atau mengatur tingkat transparansi yang digunakan untuk merender stroke pensil pada InkCanvas. Opacity adalah properti statis dari InkDrawingAttributes. Dapatkan instans kelas ini dengan memanggil InkDrawingAttributes.CreateForPencil dan mengakses InkDrawingAttributes.PencilProperties. |
Berlaku untuk
Lihat juga
- InkToolbar
- InkToolbarPencilButton
- Interaksi pena dan stylus
- Memulai: Tinta dukungan di aplikasi UWP Anda
- Sampel analisis tinta (dasar) (C#)
- Sampel pengenalan tulisan tangan tinta (C#)
- Menyimpan dan memuat goresan tinta dari file Ink Serialized Format (ISF)
- Menyimpan dan memuat goresan tinta dari clipboard
- Lokasi toolbar tinta dan sampel orientasi (dasar)
- Lokasi toolbar tinta dan sampel orientasi (dinamis)
- Sampel buku mewarnai
- Sampel catatan keluarga
- Sampel penintaan (JavaScript)
- Sampel penintaan sederhana (C#/C++)
- Sampel penintaan kompleks (C++)
- Sampel analisis tinta