0

如何更改 DirectX 库的简单按钮的字体大小。

我的猜测如下,但没有奏效;

CDXUTDialog g_SampleUI; g_SampleUI.AddButton( IDC_BUTTON_X2_Y2, L"8", (iX + (2*len)), iY, len, len ); g_SampleUI.SetFont( IDC_BUTTON_X2_Y2, L"Arial", 32, FW_BOLD );

4

1 回答 1

1

CDXUTDialog::SetFont方法不像您假设的那样将 ID作为其第一个参数。

以这种方式设置按钮的字体会更有意义(未经测试):

g_SampleUI.SetFont(1, L"Arial", 32, FW_BOLD);
CDXUTButton *button = g_SampleUI.GetButton(IDC_BUTTON_X2_Y2);
CDXUTElement *elem = button->GetElement(1);  // ..or perhaps GetElement(0)
elem->SetFont(1); // Set the font for this element to font 1 that we created on
                  // the first line
g_SampleUI.Refresh();
于 2013-04-04T08:03:48.763 回答