Transparency Property

Transparency Property

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

Declaration

[C++]

[C++]
[propget] HRESULT get_Transparency([out, retval] long *CurrentTransparency);
[propput] HRESULT put_Transparency([in] long NewTransparency);

[Microsoft® Visual Basic® 6.0]

[Visual Basic]
Public Property Get Transparency() As Long
Public Property Let Transparency( _
    ByVal NewTransparency As Long)

Property Value

long A value that indicates the transparency value of ink.

The value for the transparency can range from totally opaque, InkMinTransparencyValue (0), to totally transparent, InkMaxTransparencyValue (255). The default value is 0, opaque.

This property is read/write.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER Parameter pointer was invalid.
E_INK_EXCEPTION An exception occurs inside the method.
E_INVALIDARG The transparency is outside of the range 0 to 255.

Remarks

Note: The transparent rendering effect may be different between dynamic and static rendering. In dynamic rendering the IInkStrokeDisp 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 InkRenderer object to render the IInkStrokeDisp object.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows menu handlers that change the Transparency property of a InkDrawingAttributes object.

[Visual Basic]
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

Applies To