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


InkOverlay.AttachMode - свойство

Обновлен: Ноябрь 2007

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

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
<BrowsableAttribute(True)> _
Public Property AttachMode As InkOverlayAttachMode
'Применение
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);
}
/** @property */
/** @attribute BrowsableAttribute(true) */
public InkOverlayAttachMode get_AttachMode()
/** @property */
/** @attribute BrowsableAttribute(true) */
public  void set_AttachMode(InkOverlayAttachMode value)
public function get AttachMode () : InkOverlayAttachMode
public function set AttachMode (value : InkOverlayAttachMode)

Значение свойства

Тип: 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.

Заметки

ms582158.alert_note(ru-ru,VS.90).gifПримечание.

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.

Предупреждение

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.

Примеры

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

      

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

InkOverlay Класс

InkOverlay - члены

Microsoft.Ink - пространство имен