簡體   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