IDWriteTextFormat :: SetTextAlignment对DWRITE_TEXT_ALIGNMENT_JUSTIFIED不起作用

时间:2012-09-30 12:41:07

标签: directwrite

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;
}

enter image description here

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

1 个答案:

答案 0 :(得分:1)

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