prakash_gs
asked on
Displaying Drop down List in CComboBox
Hi
I have been trying to get a CComboBox with a Drop-List to show fonts. I think Ive done everything right but I still cant seem to see a full-drop down list. I get a very small list with 2 buttons for scrolling up and down and i can view only one of the items and not all.
Note that I also do FontComboBox.ShowDropDown( TRUE);
Please help !!
I created the combobox using the Resource View tab in Visual Studio.
The code in my OnInitDialog() is as show below:
BOOL ConfigDialog::OnInitDialog ()
{
//Load the fonts
InstalledFontCollection *installedFontCollection =
new InstalledFontCollection();
// Get the count of FontFamily objects.
int count = installedFontCollection->G etFamilyCo unt();
cout<<"installedFontCollec tion :"<<count<<endl;
FontFamily *fontFamilies ;
FontFamily *loopFamilies ;
fontFamilies = new FontFamily[count];
int temp = 0;
installedFontCollection->G etFamilies ( count,fontFamilies,&temp );
loopFamilies = fontFamilies;
// loop and get all font family names.
for(int j = 0; j < count; ++j)
{
WCHAR familyName[LF_FACESIZE];
cout<<"FamilyName::"<<fami lyName<<en dl;
loopFamilies->GetFamilyNam e(familyNa me,LANG_NE UTRAL);
CString name(familyName);
cout<<"Name::"<<name<<endl ;
FontComboBox.AddString(nam e);
loopFamilies++;
}
cout<<"No of items :"<<FontComboBox.GetCount( )<<endl;
FontComboBox.ShowDropDown( TRUE);
return TRUE; // return TRUE unless you set the focus to a control
}
-P
I have been trying to get a CComboBox with a Drop-List to show fonts. I think Ive done everything right but I still cant seem to see a full-drop down list. I get a very small list with 2 buttons for scrolling up and down and i can view only one of the items and not all.
Note that I also do FontComboBox.ShowDropDown(
Please help !!
I created the combobox using the Resource View tab in Visual Studio.
The code in my OnInitDialog() is as show below:
BOOL ConfigDialog::OnInitDialog
{
//Load the fonts
InstalledFontCollection *installedFontCollection =
new InstalledFontCollection();
// Get the count of FontFamily objects.
int count = installedFontCollection->G
cout<<"installedFontCollec
FontFamily *fontFamilies ;
FontFamily *loopFamilies ;
fontFamilies = new FontFamily[count];
int temp = 0;
installedFontCollection->G
loopFamilies = fontFamilies;
// loop and get all font family names.
for(int j = 0; j < count; ++j)
{
WCHAR familyName[LF_FACESIZE];
cout<<"FamilyName::"<<fami
loopFamilies->GetFamilyNam
CString name(familyName);
cout<<"Name::"<<name<<endl
FontComboBox.AddString(nam
loopFamilies++;
}
cout<<"No of items :"<<FontComboBox.GetCount(
FontComboBox.ShowDropDown(
return TRUE; // return TRUE unless you set the focus to a control
}
-P
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.