Поделиться через


DrawingAttributes.Transparency Property

DrawingAttributes.Transparency Property

Gets or sets a value that indicates the transparency value of ink.

Definition

Visual Basic .NET Public Property Transparency As Byte
C# public byte Transparency { get; set; }
Managed C++ public: __property Byte* get_Transparency();
public: __property void set_Transparency(Byte*);

Property Value

System.Byte. A value that indicates the transparency value of ink.

This property is read/write.

0 Default. The ink is totally opaque
0-255 The value for the transparency can range from totally opaque (0) to totally transparent (255).

Remarks

Note: The transparent rendering effect may be different between dynamic and static rendering. In dynamic rendering the Stroke object is rendered as it is drawn, as it is in the InkCollector.DynamicRendering property, for example. In static rendering, you use the Draw method of the Renderer object to render the Stroke object.

Examples

[C#]

This C# example creates event handlers for menu items that change the Transparency property of a DrawingAttributes object.

using Microsoft.Ink;
//...
    private System.Windows.Forms.MenuItem menuInkTransparencyOpaque;
    private System.Windows.Forms.MenuItem menuInkTransparencyLight;
    private InkCollector theInkCollector;
    private System.Windows.Forms.MenuItem checkedTransparency;

//...
    private void menuInkTransparencyOpaque_Click(
    object sender, System.EventArgs e)
    {
        checkedTransparency.Checked = false;
        // Set the transparency to opaque
        theInkCollector.DefaultDrawingAttributes.Transparency = 0;
        checkedTransparency = menuInkTransparencyOpaque;
        checkedTransparency.Checked = true;
        Refresh();
    }

    private void menuInkTransparencyLight_Click(
    object sender, System.EventArgs e)
    {
        checkedTransparency.Checked = false;
        // Set the transparency to about 90%
        theInkCollector.DefaultDrawingAttributes.Transparency = 220;
        checkedTransparency = menuInkTransparencyLight;
        checkedTransparency.Checked = true;
        Refresh();
    }
                

[VB.NET]

This Microsoft® Visual Basic® .NET example creates event handlers for menu items that change the Transparency property of a DrawingAttributes object.

Imports Microsoft.Ink
'...
    Dim MenuInkTransparencyOpaque As System.Windows.Forms.MenuItem
    Dim MenuInkTransparencyLight As System.Windows.Forms.MenuItem
    Dim CheckedTransparency As System.Windows.Forms.MenuItem
    Dim theInkCollector As InkCollector
'...
    Private Sub MenuInkTransparencyOpaque_Click( _
    ByVal sender As Object, ByVal e As System.EventArgs)
        CheckedTransparency.Checked = False
        'Set the transparency to opaque
        theInkCollector.DefaultDrawingAttributes.Transparency = 0
        CheckedTransparency = MenuInkTransparencyOpaque
        CheckedTransparency.Checked = True
        Refresh()
    End Sub

    Private Sub MenuInkTransparencyLight_Click( _
    ByVal sender As Object, ByVal e As System.EventArgs)
        CheckedTransparency.Checked = False
        'Set the transparency to about 90%
        theInkCollector.DefaultDrawingAttributes.Transparency = 220
        CheckedTransparency = MenuInkTransparencyLight
        CheckedTransparency.Checked = True
        Refresh()
    End Sub
                

See Also