예제 #1
0
BOOL COptionTreeItemFont::CreateFontItem(CHARFORMAT cfFont, COLORREF crFontColor, CHARFORMAT cfDefaultFont, COLORREF crDefaultFontColor, DWORD dwOptions)
{
	// Declare variables
	LOGFONT lfFont, lfDefaultFont;

	// Make sure options is not NULL
	if (m_otOption == NULL)
	{
		return FALSE;
	}

	// Save options
	m_dwOptions = dwOptions;

	// Set font
	ConvertFont(lfFont, cfFont);
	SetCurFont(lfFont);

	// Set default font
	ConvertFont(lfDefaultFont, cfDefaultFont);
	SetDefaultFont(lfDefaultFont);

	// Set color
	SetTextColor(crFontColor);

	// Set default font color
	SetDefaultTextColor(crDefaultFontColor);

	// Get default height
	m_lDefaultHeight = GetHeight();

	return TRUE;
}
예제 #2
0
void COptionTreeFontSel::OnButtonApply()
{
	// Declare variables
	CHARFORMAT cfFont = {0};
	LOGFONT lf;
	CWnd *pParent = GetParent();

	// Validate parent window
	if (pParent == NULL)
	{
		return;
	}
	if (!::IsWindow(pParent->GetSafeHwnd()))
	{
		return;
	}

	// Get fonts
	GetSelectedFont(lf);
	ConvertFont(cfFont, lf);

	// Notify parent
	if (m_dwDialogFlags & OT_FS_USECHARFORMAT)
	{
		::SendMessage(pParent->GetSafeHwnd(), OT_FS_NOTIFY_APPLY, (WPARAM) m_uControlID, (LPARAM) &cfFont);
	}
	else
	{
		::SendMessage(pParent->GetSafeHwnd(), OT_FS_NOTIFY_APPLY, (WPARAM) m_uControlID, (LPARAM) &lf);
	}

}
예제 #3
0
BOOL CWindowPage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    TRANSLATE(*this, IDD);

    m_wndSpinTextLen.SetRange32(1, TT_STRLEN);

    //convert font to LOGFONT
    ConvertFont(m_Font, m_lf);

    ShowFont();

    CStringList strings;
    GetLanguageFiles(strings);
    strings.AddHead(_T(""));

    for(POSITION pos=strings.GetHeadPosition();pos!=NULL;)
        m_wndLanguages.AddString(strings.GetNext(pos));

    if(!m_szLanguage.IsEmpty())
        m_wndLanguages.SelectString(-1, m_szLanguage);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #4
0
COptionTreeFontSel::COptionTreeFontSel(DWORD dwFlags, CHARFORMAT cfFont, CWnd* pParent /*=NULL*/): CDialog(COptionTreeFontSel::IDD, pParent)
{
	//{{AFX_DATA_INIT(COptionTreeFontSel)
	//}}AFX_DATA_INIT
	
	// Initialize variables
	m_strCustomSample = _T("");
	m_bStrikeOut = FALSE;
	m_bUnderline = FALSE;
	ConvertFont(m_lfFont, cfFont);
	ConvertFont(m_lfDefault, cfFont);
	m_dwDialogFlags = dwFlags;
	m_uControlID = 0;

	// Set text color
	SetTextColor(cfFont.crTextColor);
	SetDefaultTextColor(cfFont.crTextColor);
}
예제 #5
0
void COptionTreeFontSel::SetDefaultFont(CHARFORMAT cfFont)
{
	// Declare variables
	LOGFONT lf = {0};

	// Copy font
	ConvertFont(lf, cfFont);

	// Save font
	m_lfDefault = lf;
}
예제 #6
0
void COptionTreeItemFont::SetCurFont(CHARFORMAT cfFont)
{
	// Declare variables
	LOGFONT lf = {0};

	// Copy font
	ConvertFont(lf, cfFont);

	// Save font
	m_lfFont = lf;
}
예제 #7
0
void COptionTreeFontSel::SetCurFont(CHARFORMAT cfFont)
{
	// Declare variables
	LOGFONT lf = {0};

	// Copy font
	ConvertFont(lf, cfFont);

	// Save font
	m_lfFont = lf;

	// Objects changes
	OnObjectsChanged();
}
예제 #8
0
void COptionTreeFontSel::GetCharFormat(CHARFORMAT &cf)
{	
	// Convert font
	ConvertFont(cf, m_lfFont);
}