Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

AxHost.AboutBoxDelegate Delegate

Represents the method that will display an ActiveX control's About dialog box.

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

protected delegate void AboutBoxDelegate ()
/** @delegate */
protected delegate void AboutBoxDelegate ()
Not applicable.

The AxHost.AboutBoxDelegate provides you the ability to be notified when the ActiveX control's About box is going to be displayed. Code added to the delegate method is executed before the About box is displayed.

When you create an AxHost.AboutBoxDelegate delegate, you identify the method that will handle the display of an ActiveX control's About dialog box if it has one. To associate the method with your handler, add an instance of the delegate to the method. The handler is called whenever the method is called, unless you remove the delegate. For more information about delegates, see Events and Delegates.

The following example overrides the constructor, and the SetAboutBoxDelegate and AttachInterfaces methods of an AxHost derived class that wraps the Microsoft Masked Edit ActiveX Control. This code assumes you have created the generated source code by running the AxImp.exe on the MSMask32.ocx file with the /source switch to generate the wrapper class to be edited. This code is only shown in C# syntax as that is the the only language output by the AxImp.exe.

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);
    }
}

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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

Show:
© 2014 Microsoft