Freigeben über


AxHost.AboutBoxDelegate-Delegat

Stellt die Methode dar, die das Info-Dialogfeld eines ActiveX-Steuerelements anzeigt.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Protected Delegate Sub AboutBoxDelegate ()
'Usage
Dim instance As New AboutBoxDelegate(AddressOf HandlerMethod)
protected delegate void AboutBoxDelegate ()
private delegate void AboutBoxDelegate ()
/** @delegate */
protected delegate void AboutBoxDelegate ()
JScript unterstützt die Verwendung von Delegaten, aber nicht die Deklaration von neuen Delegaten.

Hinweise

Der AxHost.AboutBoxDelegate bietet Ihnen die Möglichkeit, sich benachrichtigen zu lassen, wenn das Info-Dialogfeld eines ActiveX-Steuerelements angezeigt wird. Der Delegatenmethode hinzugefügter Code wird vor dem Anzeigen des Info-Dialogfelds ausgeführt.

Beim Erstellen eines AxHost.AboutBoxDelegate-Delegaten bezeichnen Sie die Methode, mit der die Anzeige eines Info-Dialogfelds für ein ActiveX-Steuerelement behandelt wird, sofern dieses über ein Info-Dialogfeld verfügt. Um die Methode dem Handler zuzuordnen, fügen Sie der Methode eine Instanz des Delegaten hinzu. Wenn Sie den Delegaten nicht entfernen, wird der Handler bei jedem Aufruf der Methode aufgerufen. Weitere Informationen über Delegaten finden Sie unter Ereignisse und Delegaten.

Beispiel

Im folgenden Beispiel werden der Konstruktor sowie die SetAboutBoxDelegate-Methode und die AttachInterfaces-Methode einer von AxHost abgeleiteten Klasse überschrieben, die das Masked Edit-ActiveX-Steuerelement von Microsoft umschließt. Dabei wird davon ausgegangen, dass Sie den generierten Quellcode erstellt haben, indem Sie die Datei AxImp.exe mit der Datei MSMask32.ocx und dem /source-Schalter ausgeführt haben, um die zu bearbeitende Wrapperklasse zu erstellen. Dieser Code wird in C#-Syntax angezeigt, da dies die einzige von AxImp.exe ausgegebene Sprache ist.

public AxMaskEdBox()
    :
  base("c932ba85-4374-101b-a56c-00aa003668dc") // The ActiveX control's class identifier.
{
    // Make the AboutBox method the about box delegate.
    this.SetAboutBoxDelegate(new AboutBoxDelegate(AboutBox));
}

public virtual void AboutBox()
{
    // If the instance of the ActiveX control is null when the AboutBox method 
    // is called, raise an InvalidActiveXStateException exception.
    if ((this.ocx == null))
    {
        throw new System.Windows.Forms.AxHost.InvalidActiveXStateException(
          "AboutBox", System.Windows.Forms.AxHost.ActiveXInvokeKind.MethodInvoke);
    }
    // Show the about box if the ActiveX control has one.
    if (this.HasAboutBox)
    {
        this.ocx.AboutBox();
    }
}

protected override void AttachInterfaces()
{
    try
    {
        // Attach the IMSMask interface to the ActiveX control.
        this.ocx = ((MSMask.IMSMask)(this.GetOcx()));
    }
    catch (System.Exception ex)
    {
        System.Console.WriteLine(ex.Message);
    }
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

System.Windows.Forms-Namespace
SetAboutBoxDelegate
ShowAboutBox
AxHost.HasAboutBox-Eigenschaft