Sdílet prostřednictvím


DrawingAttributes.Transparency Property

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

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Property Transparency As Byte
'Usage
Dim instance As DrawingAttributes 
Dim value As Byte 

value = instance.Transparency

instance.Transparency = value
public byte Transparency { get; set; }
public:
property unsigned char Transparency {
    unsigned char get ();
    void set (unsigned char value);
}
public function get Transparency () : byte 
public function set Transparency (value : byte)

Property Value

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

Value

Meaning

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

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

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

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

DrawingAttributes Class

DrawingAttributes Members

Microsoft.Ink Namespace

Renderer

Renderer.Draw

InkCollector.DynamicRendering

InkOverlay.DynamicRendering

InkPicture.DynamicRendering