다음을 통해 공유


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);
}
/** @property */
public byte get_Transparency ()

/** @property */
public void set_Transparency (byte value)
public function get Transparency () : byte

public function set Transparency (value : byte)
Not applicable.

Property Value

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.

Example

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

DrawingAttributes Class
DrawingAttributes Members
Microsoft.Ink Namespace
Renderer
Microsoft.Ink.Renderer.Draw
InkCollector.DynamicRendering
InkOverlay.DynamicRendering
InkPicture.DynamicRendering