void CFontPropPage::OnObjectsChanged() { ULONG nObjects; if (GetObjectArray(&nObjects) != NULL && m_hWnd != NULL) { FillPropnameList(IID_IFontDisp, 1, m_FontProp); if ( m_FontProp.GetCount() > 0 ) FillFacenameList(); else { m_FontNames.EnableWindow(FALSE); m_FontSizes.EnableWindow(FALSE); m_FontStyles.EnableWindow(FALSE); GetDlgItem(AFX_IDC_STRIKEOUT)->EnableWindow(FALSE); GetDlgItem(AFX_IDC_UNDERLINE)->EnableWindow(FALSE); } } if (m_hWnd != NULL) OnSelchangeFontprop(); }
void CFontPropertyPage::set_properties() { FillFacenameList(); itemChoice10->AppendString( "Regular" ); itemChoice10->AppendString( "Italic" ); itemChoice10->AppendString( "Bold" ); itemChoice10->AppendString( "Bold Italic" ); if( m_font.IsOk() ) { int sel = itemChoice7->FindString( m_font.GetFaceName() ); if( sel != wxNOT_FOUND ) { itemChoice7->SetSelection( sel ); FillSizeList(); } } itemChoice16->SetValue( m_textStr ); itemChoice17->SetValue( m_backgroundStr ); if( m_bUnderline ) itemCheckBox1->Enable( true ); if( m_bStrikethrough ) itemCheckBox2->Enable( true ); if( m_font.IsOk() ) { if( m_font.GetStyle() == wxFONTSTYLE_ITALIC && m_font.GetWeight() == wxFONTWEIGHT_BOLD ) itemChoice10->SetSelection( itemChoice10->FindString( "Bold Italic" ) ); else if( m_font.GetStyle() == wxFONTSTYLE_ITALIC ) itemChoice10->SetSelection( itemChoice10->FindString( "Italic" ) ); else if( m_font.GetWeight() == wxFONTWEIGHT_BOLD ) itemChoice10->SetSelection( itemChoice10->FindString( "Bold" ) ); else itemChoice10->SetSelection( itemChoice10->FindString( "Regular" ) ); } else { itemChoice10->SetSelection( itemChoice10->FindString( "Regular" ) ); itemChoice19->SetSelection( itemChoice19->FindString( "0" ) ); } }