Share via


InkOverlay.AttachMode Property

Gets or sets the value that specifies whether the InkOverlay object is attached behind or in front of the known window.

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

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Property AttachMode As InkOverlayAttachMode
'Usage
Dim instance As InkOverlay 
Dim value As InkOverlayAttachMode 

value = instance.AttachMode

instance.AttachMode = value
[BrowsableAttribute(true)]
public InkOverlayAttachMode AttachMode { get; set; }
[BrowsableAttribute(true)]
public:
property InkOverlayAttachMode AttachMode {
    InkOverlayAttachMode get ();
    void set (InkOverlayAttachMode value);
}
public function get AttachMode () : InkOverlayAttachMode 
public function set AttachMode (value : InkOverlayAttachMode)

Property Value

Type: Microsoft.Ink.InkOverlayAttachMode
The value that specifies whether the InkOverlay object is attached behind or in front of the known window.

Value

Meaning

Behind

Default. The InkOverlay is attached behind the known window. ink is drawn underneath child controls.

InFront

The InkOverlay is attached in front of the known window. ink is drawn on top of child controls.

Remarks

Note

An error occurs if the InkOverlay object is not disabled before setting this property. To disable the InkOverlay object, set the Enabled property to false. You can then set the InkOverlayAttachMode property and re-enable the object by setting the Enabled property to true.

To repaint a stroke in the InkOverlay object when it is attached in in front of the known window, call the form's Invalidate(rect, true) overload, which forces all child controls to repaint.

Warning

If AttachMode is set to InFront and then a control is added to the InkOverlay's AttachedControl, then you will have to re-attach the control. First set Enabled to false, then set the AttachedControl property, and then set Enabled to true.

Examples

This C# example creates an InkOverlay object, theInkOverlay and attaches it to a Panel, thePanel, on a windows form. Then, the AttachMode property is used to enable and disable inking on top of a Label control, theLabel, that is on the panel.

using System;
using System.Windows.Forms;
using Microsoft.Ink;


public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel thePanel;
  private System.Windows.Forms.CheckBox theCheckBox;
  private System.Windows.Forms.Label theLabel;  
  private Microsoft.Ink.InkOverlay theInkOverlay;

  // Windows Form Designer generated code
  // . . .

  public Form1()
  {
    theInkOverlay = new Microsoft.Ink.InkOverlay();
    theInkOverlay.Handle = thePanel.Handle;
    theInkOverlay.Enabled = true;  
  }

  // Toggle AttachMode between InFront and Behind.
  private void theCheckBox_CheckedChanged(object sender, System.EventArgs e)
  {
    theInkOverlay.Enabled = false;
    if (theInkOverlay.AttachMode == InkOverlayAttachMode.InFront)
    {
      theInkOverlay.AttachMode = InkOverlayAttachMode.Behind;
    }
    else
    {
      theInkOverlay.AttachMode = InkOverlayAttachMode.InFront;
    }
    theInkOverlay.Enabled = true;
  }

}
      

This Microsoft Visual Basic .NET example creates an InkOverlay object, theInkOverlay and attaches it to a Panel, thePanel, on a windows form. Then, the AttachMode property is used to enable and disable inking on top of a Label control, theLabel that is on the panel.

Imports Microsoft.Ink
      
Public Class Form1
    Inherits System.Windows.Forms.Form

    'Windows Form Designer generated code 
    '. . .

    Private WithEvents theInkOverlay As Microsoft.Ink.InkOverlay
    Friend WithEvents thePanel As System.Windows.Forms.Panel
    Friend WithEvents theCheckBox As System.Windows.Forms.CheckBox

  Public Sub New()
        MyBase.New()

        theInkOverlay = New Microsoft.Ink.InkOverlay()
        theInkOverlay.Handle = thePanel.Handle
        theInkOverlay.Enabled = True
    End Sub
  
'. . .

    Private Sub theCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles theCheckBox.CheckedChanged
        theInkOverlay.Enabled = False

        If theInkOverlay.AttachMode = InkOverlayAttachMode.Behind Then
            theInkOverlay.AttachMode = InkOverlayAttachMode.InFront
        Else
            theInkOverlay.AttachMode = InkOverlayAttachMode.Behind
        End If

        theInkOverlay.Enabled = True
    End Sub
End Class

      

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

InkOverlay Class

InkOverlay Members

Microsoft.Ink Namespace