大网数据广告活动
Windows 系统接口

Visual Representation

· 52CE 我爱测

A control supports positioning and displaying itself within its container through compound document technology and OLE drag and drop technology that involves both the control and its container.

A control supports positioning and displaying itself within its container through compound document technology and OLE drag and drop technology that involves both the control and its container. The control must be able to draw itself while the container manages the position of the control and its size.

Controls add to the basic functions provided by OLE documents. A control calls its client's IOleClientSite::RequestNewObjectLayout method to tell its container that it wants to change its size. The client calls the control's IOleObject::GetExtent to get the new size and calls IOleInPlaceObject::SetObjectRects to set the control to its new size.

Controls that support only IPersistStream or IPersistStreamInit do not support caching through IOleCache2 because the cache requires support for IPersistStorage. However, these controls should provide a way for the client to render the control through IDataObject::GetData so the client can optionally create and manage its own cache of the presentation data for the control.

Controls use the HIMETRIC type for its coordinates. However, different containers can use different coordinate systems. The container wants to receive coordinates in its own system, but the control does not necessarily know what coordinates its container is using. To communicate successfully, the control needs a way to convert values to its container's coordinates. The container provides a site object with the IOleControlSite::TransformCoords method. The control calls this method on its container's client site first to convert its coordinates into the appropriate coordinates for the container. Then, it can pass the converted coordinates to the container.

Controls can call IOleControlSite::LockInPlaceActive in the container's site object to prevent the container from attempting to demote the control out of the in-place active state. Demoting the control in this way causes the control to be deactivated and its window destroyed, so if the control must maintain its window for a known duration it can call LockInPlaceActive to guarantee its state.

Related topics

ActiveX Controls

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。