共用方式為


PX_VBXFontConvert

Call this function within your control's DoPropExchange member function to initialize a font property by converting a VBX control's font-related properties.

BOOL PX_VBXFontConvert(
   CPropExchange* pPX,
   CFontHolder& font 
);

Parameters

  • pPX
    Pointer to the CPropExchange object (typically passed as a parameter to DoPropExchange).

  • font
    The font property of the OLE control that will contain the converted VBX font-related properties.

Return Value

Nonzero if the exchange was successful; 0 if unsuccessful.

Remarks

This function should be used only by an OLE control that is designed as a direct replacement for a VBX control. When the Visual Basic development environment converts a form containing a VBX control to use the corresponding replacement OLE control, it will call the control's IDataObject::SetData function, passing in a property set that contains the VBX control's property data. This operation, in turn, causes the control's DoPropExchange function to be invoked. DoPropExchange can call PX_VBXFontConvert to convert the VBX control's font-related properties (for example, "FontName," "FontSize," and so on) into the corresponding components of the OLE control's font property.

PX_VBXFontConvert should only be called when the control is actually being converted from a VBX form application. For example:

void CMFCActiveXControlCtrl::DoPropExchange(CPropExchange* pPX)
{
   ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor));
   COleControl::DoPropExchange(pPX);

   if (IsConvertingVBX())
      PX_VBXFontConvert(pPX, InternalGetFont());


...


}

Requirements

Header: afxctl.h

See Also

Reference

COleControl::DoPropExchange

COleControl::AmbientFont

PX_Font

Concepts

MFC Macros and Globals