Esempio n. 1
0
void CMainFrame::OnFontSizeChange() 
{
	CString szText;
	m_wndEditBar.m_fontSizeCombo.GetLBText(
		m_wndEditBar.m_fontSizeCombo.GetCurSel(),szText);

	CHTMLEdView *pView = (CHTMLEdView*)GetActiveView();
	ASSERT_VALID(pView);

	pView->SetFontSize((short)_ttoi(szText));
}
Esempio n. 2
0
HRESULT SetFont(CMainFrame* pFrame, IPropertyStore* pStore)
{
    HRESULT hr = S_OK;

    // Get the HTML editor.
    CHTMLEdView *pView = (CHTMLEdView*)pFrame->GetActiveView();
    if (pView == NULL)
    {
        return E_FAIL;
    }
    
    // Set Font Face.
    PROPVARIANT face;
    hr = pStore->GetValue(UI_PKEY_FontProperties_Family, &face);
    if (FAILED(hr))
    {
        return hr;
    }

    CString strFontFace(face.pwszVal);
    hr = pView->SetFontFace(strFontFace.GetBuffer());
    if (FAILED(hr))
    {
        return hr;
    }

    PropVariantClear(&face);
        
    // Set Font Size.
    PROPVARIANT size;
    hr = pStore->GetValue(UI_PKEY_FontProperties_Size, &size);
    if (FAILED(hr))
    {
        return hr;
    }

    USHORT uSize;
    VarUI2FromDec(&size.decVal, &uSize);
    hr = pView->SetFontSize(uSize - 7);
    if (FAILED(hr))
    {
        return hr;
    }

    PropVariantClear(&size);
    return hr;
}