繁体   English   中英

DirectX:如何更改按钮对象的字体大小?

[英]DirectX: How do i change button object's font size?

如何更改 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 );

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();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM