2

IDWriteTextFormat::SetTextAlignment 用于在 DirectWrite 中对齐文本,它需要一个 DWRITE_TEXT_ALIGNMENT 类型的参数

enum DWRITE_TEXT_ALIGNMENT {
  DWRITE_TEXT_ALIGNMENT_LEADING,
  DWRITE_TEXT_ALIGNMENT_TRAILING,
  DWRITE_TEXT_ALIGNMENT_CENTER,
  DWRITE_TEXT_ALIGNMENT_JUSTIFIED 
};

前 3 种都运行良好,但最后一种 DWRITE_TEXT_ALIGNMENT_JUSTIFIED 不起作用,当我尝试设置它时,我得到一个无效参数错误

HRESULT hr = g_pTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_JUSTIFIED);
if(FAILED(hr))
{
    MessageBox(NULL, L"Center text failed!", L"Error", 0);
    return;
}

在此处输入图像描述

这似乎不是一个有效的论点,为什么?有人遇到同样的问题吗?

4

1 回答 1

2

从Microsoft DirectX论坛得到了答案,因为这个标志不支持Win7,但是SDK文档没有指出。 http://xboxforums.create.msdn.com/forums/p/108456/640004.aspx#640004

于 2012-10-12T02:34:50.783 回答