问题描述
我有一个CComboBox,当前以其对应的字体显示所有不同的可选字体.我用过的方法:
Hi,
I have a CComboBox that currently displays all the different selectable fonts in their respsective fonts. I have used the method:
EnumFontFamiliesEx(.....)
,效果很好.
但是,我现在只需要显示其中一些字体选项.是否有一种简单的方法来选择例如Arial,Calibri,Times New Roman要以自己的字体显示在组合框中吗?
我找不到使用EnumFontFamiliesEx方法执行此操作的方法,因此我尝试使用以下代码,但是尽管添加了字符串"Arial"(MyComboBox类为源自CComboBox):
and it works great.
However, I now need to only show a few of these font options. Is there an easy way to just select e.g. Arial, Calibri, Times New Roman to be displayed in the combobox in their own fonts?
I couldn''t find a way to do this using the EnumFontFamiliesEx method so I tried to use the following code, but it did not change the font style shown in the combo box, although the string "Arial" was added (MyComboBox class is derived from CComboBox):
void MyComboBoxClass::SetFonts()
{
CFont font;
font.CreatePointFont80,"Arial");
SetFont(&font);
CClientDC dc(this);
dc.SelectObject(&font);
AddString("Arial");
我将组合框的所有者绘制设置更改为所有选项,但没有任何帮助.
有没有简单的方法可以做我想做的事情,或者有人可以帮助我找出复杂的方法吗?
非常感谢您的帮助.
I changed the owner draw setting of the combo box to all its options and nothing helped.
Is there a simple way to do what I am trying to do, or can someone help me figure out the complicated way please?
Very many thanks in advance for any help.
推荐答案
这篇关于CComboBox需要以不同的字体显示一些字体名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!