CComCompositeControl选件类

此选件类提供需要的方法实现复合控件。

重要

此选件类及其成员不能在Windows运行时执行的应用程序。

template <
class T 
>
class CComCompositeControl :
public CComControl< T, CAxDialogImpl< T > >

参数

成员

z3e7bbb1.collapse_all(zh-cn,VS.110).gif公共构造函数

名称

描述

CComCompositeControl::CComCompositeControl

构造函数。

CComCompositeControl::~CComCompositeControl

该析构函数。

z3e7bbb1.collapse_all(zh-cn,VS.110).gif公共方法

名称

描述

CComCompositeControl::AdviseSinkMap

调用此方法建议或unadvise该复合控件中承载的所有控件。

CComCompositeControl::CalcExtent

调用此方法计算在所使用的对话框资源的 HIMETRIC 单元的大小承载复合控件。

CComCompositeControl::Create

此方法调用创建复合控件的控件的窗口。

CComCompositeControl::CreateControlWindow

调用此方法创建控件的窗口和建议所有承载控件。

CComCompositeControl::SetBackgroundColorFromAmbient

使用容器的背景色,调用此方法将复合控件的背景色。

z3e7bbb1.collapse_all(zh-cn,VS.110).gif公共数据成员

名称

描述

CComCompositeControl::m_hbrBackground

背景画笔。

CComCompositeControl::m_hWndFocus

当前具有焦点的窗口的句柄。

备注

从选件类派生的选件类 CComCompositeControl 继承ActiveX复合控件的功能。 从 CComCompositeControl 派生的ActiveX控件由标准对话框承载。 以下类型的控件调用复合控件,因为它们可以承载其他控件(本机Windows控件和ActiveX控件)。

CComCompositeControl 在创建标识对话框资源使用该复合控件通过查找一个计数值成员在子选件类。 此子选件类的成员IDD设置为将用作控件windows对话框资源的资源ID。 下面是从 CComCompositeControl 派生的选件类应包含标识用于控制windows将使用的对话框资源数据成员的示例:

enum { IDD = IDD_MYCOMPOSITE };

备注

复合控件始终有窗口的控件,不过,它们可能包含无窗口控件。

CComCompositeControl实现的控件-具有默认tab键行为安装的派生类。 当控件通过选项卡式接收焦点到包含组件的应用程序,串行按tab键将导致焦点通过所有复合控件所包含的控件中循环,然后从该复合控件和到下一个项目选项按容器的序列。 对话框资源取决于承载的控件的tab键顺序并确定选定将发生的顺序。

备注

为了快捷键可以用于 CComCompositeControl时,加载快捷键对应表,因为控件创建有必要,通过快捷键的句柄和数量回 IOleControlImpl::GetControlInfo最后销毁表,释放该控件。

示例

// Example for overriding IOleControlImpl::GetControlInfo()
// This example uses the accelerator table from the project resources
// with the identifier IDR_ACCELTABLE
// Define GetControlInfo() in the header of your composite 
// control class as follows:

STDMETHOD(GetControlInfo)(CONTROLINFO* pCI)
{
    // Load the accelerator table from the resource
    pCI->hAccel = LoadAccelerators(_AtlBaseModule.GetResourceInstance(), 
       MAKEINTRESOURCE(IDR_ACCELTABLE));

    if (pCI->hAccel == NULL)
        return E_FAIL;

    // Get the number of accelerators in the table
    pCI->cAccel = (USHORT)CopyAcceleratorTable(pCI->hAccel, NULL, 0);
    // The following is optional if you want your control
    // to process the return and/or escape keys
    // pCI.dwFlags = CTRLINFO_EATS_RETURN | CTRLINFO_EATS_ESCAPE;
    pCI->dwFlags = 0;

    return S_OK;
}

继承层次结构

WinBase

CComControlBase

CComControl

CComCompositeControl

要求

Header: atlctl.h

请参见

参考

CComControl选件类

概念

复合控件的基本知识

其他资源

ATL选件类概述