Edit

Kongsi melalui


CAtlPreviewCtrlImpl Class

Note

The Active Template Library (ATL) continues to be supported. However, we're no longer adding features or updating the documentation.

This class is an ATL implementation of a window that is placed on a host window provided by the Shell for Rich Preview.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

Syntax

class CAtlPreviewCtrlImpl : public CWindowImpl<CAtlPreviewCtrlImpl>, public IPreviewCtrl;

Members

Public Constructors

Name Description
CAtlPreviewCtrlImpl::~CAtlPreviewCtrlImpl Destructs a preview control object.
CAtlPreviewCtrlImpl::CAtlPreviewCtrlImpl Constructs a preview control object.

Public Methods

Name Description
CAtlPreviewCtrlImpl::Create Called by a Rich Preview handler to create the Windows window.
CAtlPreviewCtrlImpl::Destroy Called by a Rich Preview handler when it needs to destroy this control.
CAtlPreviewCtrlImpl::Focus Sets input focus to this control.
CAtlPreviewCtrlImpl::OnPaint Handles the WM_PAINT message.
CAtlPreviewCtrlImpl::Redraw Tells this control to redraw.
CAtlPreviewCtrlImpl::SetHost Sets a new parent for this control.
CAtlPreviewCtrlImpl::SetPreviewVisuals Called by a Rich Preview handler when it needs to set visuals of rich preview content.
CAtlPreviewCtrlImpl::SetRect Sets a new bounding rectangle for this control.

Protected Methods

Name Description
CAtlPreviewCtrlImpl::DoPaint Called by the framework to render the preview.

Protected Constants

Name Description
CAtlPreviewCtrlImpl::m_plf Font used to display text in the preview window.

Protected Data Members

Name Description
CAtlPreviewCtrlImpl::m_clrBack Background color of the preview window.
CAtlPreviewCtrlImpl::m_clrText Text color of preview window.

Remarks

Inheritance Hierarchy

TBase

ATL::CMessageMap

ATL::CWindowImplRoot<TBase>

ATL::CWindowImplBaseT<TBase,TWinTraits>

ATL::CWindowImpl<CAtlPreviewCtrlImpl>

IPreviewCtrl

ATL::CAtlPreviewCtrlImpl

Requirements

Header: atlpreviewctrlimpl.h

CAtlPreviewCtrlImpl::CAtlPreviewCtrlImpl

Constructs a preview control object.

CAtlPreviewCtrlImpl(void) : m_clrText(0),
   m_clrBack(RGB(255, 255, 255)), m_plf(NULL);

Remarks

CAtlPreviewCtrlImpl::~CAtlPreviewCtrlImpl

Destructs a preview control object.

virtual ~CAtlPreviewCtrlImpl(void);

Remarks

CAtlPreviewCtrlImpl::Create

Called by a Rich Preview handler to create the Windows window.

virtual BOOL Create(HWND hWndParent, const RECT* prc);

Parameters

hWndParent
A handle to the host window supplied by the Shell for Rich Preview.

prc
Specifies the initial size and position of the window.

Return Value

TRUE if successful; otherwise FALSE.

Remarks

CAtlPreviewCtrlImpl::Destroy

Called by a Rich Preview handler when it needs to destroy this control.

virtual void Destroy();

Remarks

CAtlPreviewCtrlImpl::DoPaint

Called by the framework to render the preview.

virtual void DoPaint(HDC hdc);

Parameters

hdc
A handle to a device context for painting.

Remarks

CAtlPreviewCtrlImpl::Focus

Sets input focus to this control.

virtual void Focus();

Remarks

CAtlPreviewCtrlImpl::m_clrBack

Background color of the preview window.

COLORREF m_clrBack;

Remarks

CAtlPreviewCtrlImpl::m_clrText

Text color of the preview window.

COLORREF m_clrText;

Remarks

CAtlPreviewCtrlImpl::m_plf

Font used to display text in the preview window.

const LOGFONTW* m_plf;

Remarks

CAtlPreviewCtrlImpl::OnPaint

Handles the WM_PAINT message.

LRESULT OnPaint(
    UINT nMsg,
    WPARAM wParam,
    LPARAM lParam,
    BOOL& bHandled);

Parameters

nMsg
Set to WM_PAINT.

wParam
This parameter is not used.

lParam
This parameter is not used.

bHandled
When this function returns, it contains TRUE.

Return Value

Always returns 0.

Remarks

CAtlPreviewCtrlImpl::Redraw

Tells this control to redraw.

virtual void Redraw();

Remarks

CAtlPreviewCtrlImpl::SetHost

Sets a new parent for this control.

virtual void SetHost(HWND hWndParent);

Parameters

hWndParent
A handle to the new parent window.

Remarks

CAtlPreviewCtrlImpl::SetPreviewVisuals

Called by a Rich Preview handler when it needs to set visuals of rich preview content.

virtual void SetPreviewVisuals(
    COLORREF clrBack,
    COLORREF clrText,
    const LOGFONTW* plf);

Parameters

clrBack
Background color of the preview window.

clrText
Text color of the preview window.

plf
Font used to display text in the preview window.

Remarks

CAtlPreviewCtrlImpl::SetRect

Sets a new bounding rectangle for this control.

virtual void SetRect(const RECT* prc, BOOL bRedraw);

Parameters

prc
Specifies the new size and position of the preview control.

bRedraw
Specifies whether the control should be redrawn.

Remarks

See also

ATL COM Desktop Components