[英]Displaying text in static text field in mfc dialog
I built a game in MFC, and I want to display the score user got in static text field of dialog, so I want to do something something like this: 我在MFC中构建了一个游戏,我想显示用户在对话框的静态文本字段中获得的分数,因此我想执行以下操作:
staticScore.SetWindowText(_T("you got %d points", score));
But this doens't work, this displays "you got %d points" without replacing %d with score. 但这是行不通的,它显示“您获得了%d分”而没有用分数替换%d。
How can I display number that is stored in some variable in static text field? 如何显示存储在静态文本字段中某些变量中的数字?
CString score;
score.Format(_T("You got %d points"),m_score);
staticScore.SetWindowText(score);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.