AxHost.HasAboutBox 属性

定义

获取一个值,该值指示 ActiveX 控件是否拥有“关于”对话框。Gets a value indicating whether the ActiveX control has an About dialog box.

public:
 property bool HasAboutBox { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool HasAboutBox { get; }
member this.HasAboutBox : bool
Public ReadOnly Property HasAboutBox As Boolean

属性值

true如果 ActiveX 控件具有 "关于" 对话框,则为;否则为falsetrue if the ActiveX control has an About dialog box; otherwise, false.

属性

示例

下面的代码示例将重写构造函数, SetAboutBoxDelegate以及AttachInterfaces包装 Microsoft 掩码AxHost编辑 ActiveX 控件的派生类的和方法。The following code example overrides the constructor, and the SetAboutBoxDelegate and AttachInterfaces methods of an AxHost derived class that wraps the Microsoft Masked Edit ActiveX Control. 此代码要求你已创建生成的源代码,方法是在 MSMask32 文件上运行 aximp.exe,并使用/source开关生成要编辑的包装类。This code requires that 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. 此代码仅在语法中C#显示,因为这是 aximp.exe 所输出的唯一语言。This code is only shown in C# syntax because that is 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);
    }
}

注解

"关于" 对话框通常显示有关 ActiveX 控件的版本和版权信息。The About dialog box typically displays version and copyright information about the ActiveX control.

适用于

另请参阅