共用方式為


CD2DTextLayout 類別

IDWriteTextLayout 的包裝函式。

語法

class CD2DTextLayout : public CD2DResource;

成員

公用建構函式

名稱 描述
CD2DTextLayout::CD2DTextLayout 建構 CD2DTextLayout 物件。
CD2DTextLayout::~CD2DTextLayout 解構函式。 當 D2D 文字版面設定物件被終結時呼叫。

公用方法

名稱 描述
CD2DTextLayout::Create 建立 CD2DTextLayout。 (覆寫 CD2DResource::Create .)
CD2DTextLayout::D estroy 終結 CD2DTextLayout 物件。 (覆寫 CD2DResource::D estroy .)
CD2DTextLayout::Get 傳回 IDWriteTextLayout 介面
CD2DTextLayout::GetFontFamilyName 複製位於指定位置之文字的字型系列名稱。
CD2DTextLayout::GetLocaleName 取得位於指定位置之文字的地區設定名稱。
CD2DTextLayout::IsValid 檢查資源有效性 (覆寫 CD2DResource::IsValid .)
CD2DTextLayout::ReCreate 重新建立 CD2DTextLayout。 (覆寫 CD2DResource::ReCreate .)
CD2DTextLayout::SetFontFamilyName 設定指定文字範圍內文字的 Null 終止字型系列名稱
CD2DTextLayout::SetLocaleName 設定指定文字範圍內文字的地區設定名稱

公用運算子

名稱 描述
CD2DTextLayout::operator IDWriteTextLayout* 傳回 IDWriteTextLayout 介面

受保護的資料成員

名稱 描述
CD2DTextLayout::m_pTextLayout IDWriteTextLayout 的指標。

繼承階層架構

CObject

CD2DResource

CD2DTextLayout

需求

標頭: afxrendertarget.h

CD2DTextLayout::~CD2DTextLayout

解構函式。 當 D2D 文字版面設定物件被終結時呼叫。

virtual ~CD2DTextLayout();

CD2DTextLayout::CD2DTextLayout

建構 CD2DTextLayout 物件。

CD2DTextLayout(
    CRenderTarget* pParentTarget,
    const CString& strText,
    CD2DTextFormat& textFormat,
    const CD2DSizeF& sizeMax,
    BOOL bAutoDestroy = TRUE);

參數

pParentTarget
轉譯目標的指標。

strText
CString 物件,其中包含要從中建立新 CD2DTextLayout 物件的字串。

textFormat
包含要套用至字串之格式的 CString 物件。

sizeMax
配置方塊的大小。

bAutoDestroy
表示物件將會由擁有者終結(pParentTarget)。

CD2DTextLayout::Create

建立 CD2DTextLayout。

virtual HRESULT Create(CRenderTarget* */);

傳回值

如果方法成功,則會傳回S_OK。 否則,它會傳回 HRESULT 錯誤碼。

CD2DTextLayout::D estroy

終結 CD2DTextLayout 物件。

virtual void Destroy();

CD2DTextLayout::Get

傳回 IDWriteTextLayout 介面

IDWriteTextLayout* Get();

傳回值

如果物件尚未初始化,則為 IDWriteTextLayout 介面的指標或 Null。

CD2DTextLayout::GetFontFamilyName

複製位於指定位置之文字的字型系列名稱。

CString GetFontFamilyName(
    UINT32 currentPosition,
    DWRITE_TEXT_RANGE* textRange = NULL) const;

參數

currentPosition
要檢查之文字的位置。

textRange
與 currentPosition 所指定位置的文字格式相同之文字範圍。 這表示執行具有指定位置的確切格式,包括但不限於字型系列名稱。

傳回值

包含目前字型系列名稱的 CString 物件。

CD2DTextLayout::GetLocaleName

取得位於指定位置之文字的地區設定名稱。

CString GetLocaleName(
    UINT32 currentPosition,
    DWRITE_TEXT_RANGE* textRange = NULL) const;

參數

currentPosition
要檢查之文字的位置。

textRange
與 currentPosition 所指定位置的文字格式相同之文字範圍。 這表示執行具有指定位置的確切格式,包括但不限於地區設定名稱。

傳回值

包含目前地區設定名稱的 CString 物件。

CD2DTextLayout::IsValid

檢查資源有效性

virtual BOOL IsValid() const;

傳回值

如果資源有效,則為 TRUE;否則為 FALSE。

CD2DTextLayout::m_pTextLayout

IDWriteTextLayout 的指標。

IDWriteTextLayout* m_pTextLayout;

CD2DTextLayout::operator IDWriteTextLayout*

傳回 IDWriteTextLayout 介面

operator IDWriteTextLayout*();

傳回值

如果物件尚未初始化,則為 IDWriteTextLayout 介面的指標或 Null。

CD2DTextLayout::ReCreate

重新建立 CD2DTextLayout。

virtual HRESULT ReCreate(CRenderTarget* */);

傳回值

如果方法成功,則會傳回S_OK。 否則,它會傳回 HRESULT 錯誤碼。

CD2DTextLayout::SetFontFamilyName

設定指定文字範圍內文字的 Null 終止字型系列名稱

BOOL SetFontFamilyName(
    LPCWSTR pwzFontFamilyName,
    DWRITE_TEXT_RANGE textRange);

參數

pwzFontFamilyName
套用至 textRange 所指定範圍內整個文字字串的字型系列名稱

textRange
套用此變更的文字範圍

傳回值

如果方法成功,則會傳回 TRUE。 否則會傳回 FALSE

CD2DTextLayout::SetLocaleName

設定指定文字範圍內文字的地區設定名稱

BOOL SetLocaleName(
    LPCWSTR pwzLocaleName,
    DWRITE_TEXT_RANGE textRange);

參數

pwzLocaleName
以 Null 結尾的地區設定名稱字串

textRange
套用此變更的文字範圍

傳回值

如果方法成功,則會傳回 TRUE。 否則會傳回 FALSE

另請參閱

類別