Exemplo n.º 1
0
void CVisualSynanView::OnFonts() 
{
	CFontDialog dlgFonts;	

	if( dlgFonts.DoModal() != IDOK)
		return;

	LOGFONT lfOldFont;
	LogFontCpy(&lfOldFont, m_LogFontForWords);
	dlgFonts.GetCurrentFont(&m_LogFontForWords);
	CString str = dlgFonts.GetFaceName();
	CClientDC dc(this);
	EnumFontFamiliesEx(dc.m_hDC, &m_LogFontForWords, &TestIfTrueTypeEx,(LPARAM)this,0);
	if( !m_bExistUsefulFont )
	{
		::AfxMessageBox(IDS_NOT_TRUE_TYPE);
		LogFontCpy(&m_LogFontForWords,lfOldFont);
		return;
	}
	if(!(m_LogFontForWords.lfCharSet & RUSSIAN_CHARSET) )
	{
		::AfxMessageBox(IDS_NOT_RUSSIAN_CHARSET);
		LogFontCpy(&m_LogFontForWords,lfOldFont);
		return;
	};

	// m_LogFontForWords has changed!!
	UpdateFontsFromLogFont();

	CClientDC clDC(this);
	Recalculate(clDC);
	Invalidate();
}
Exemplo n.º 2
0
UINT CALLBACK CPPgDisplay::ChooseFontHook(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
{
	UINT uResult;

	// Call MFC's common dialog Hook function
	if (_pfnChooseFontHook != NULL)
		uResult = (*_pfnChooseFontHook)(hdlg, uiMsg, wParam, lParam);
	else
		uResult = 0;

	// Do our own Hook processing
	switch (uiMsg)
	{
	case WM_COMMAND:
		if (LOWORD(wParam) == psh3/*Apply*/ && HIWORD(wParam) == BN_CLICKED)
		{
			LOGFONT lf;
			CFontDialog *pDlg = (CFontDialog *)CWnd::FromHandle(hdlg);
			ASSERT( pDlg != NULL );
			if (pDlg != NULL)
			{
				pDlg->GetCurrentFont(&lf);
				if (_pThis->m_eSelectFont == sfLog)
					theApp.emuledlg->ApplyLogFont(&lf);
				else
					theApp.emuledlg->ApplyHyperTextFont(&lf);
			}
		}
		break;
	}

	// If the hook procedure returns zero, the default dialog box procedure processes the message.
	return uResult;
}
Exemplo n.º 3
0
BOOL COXFontPickerButton::OnClicked()
{
    ASSERT(::IsWindow(m_hWnd));

    // Use font common dialog
    CFontDialog* pFontDlg;
    CFont* pFont=GetBuddyFont();
    LOGFONT lf;
    if(pFont==NULL)
    {
        pFontDlg=new CFontDialog();
    }
    else
    {
        pFont->GetLogFont(&lf);
        pFontDlg=new CFontDialog(&lf);
    }

    pFontDlg->m_cf.rgbColors=GetBuddyTextColor();
    if(pFontDlg->DoModal()==IDOK && m_pBuddy!=NULL)
    {
        pFontDlg->GetCurrentFont(&lf);
        SetBuddyLogFont(&lf,FALSE);
        COLORREF clr=pFontDlg->GetColor();
        SetBuddyTextColor(clr,TRUE);
    }

    delete pFontDlg;

    return FALSE;
}
Exemplo n.º 4
0
void CTextPadDlg::OnBnClickedFontsetbtn()
{
	// TODO: Add your control notification handler code here
	CFontDialog dlg;
	
	//CFontDialog로 현재 폰트 변경
	if(dlg.DoModal() == IDOK){
		color = dlg.GetColor();
		dlg.GetCurrentFont(&log);
		font.DeleteObject();
		font.CreateFontIndirect(&log);
		GetDlgItem(IDC_EDIT1)->SetFont(&font);
	}
}
Exemplo n.º 5
0
void CLabelDlg::OnFont() 
{
	CFontDialog dlg;
	
	if (dlg.DoModal() == IDOK)
	{
		LOGFONT logFont;
		dlg.GetCurrentFont (&logFont);
		m_pLabel->SetFont (&logFont);
		m_pLabel->SetTextColor(dlg.GetColor ());
		OnChanged();
	}
	
}
void COptionPageTextFormat::OnEditorSelectfont()
{
    // select font for editor
    CFontDialog fontdlg;
    LOGFONT tmpFont = m_logfont;

    fontdlg.m_cf.lpLogFont = &tmpFont;
    fontdlg.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT;
    fontdlg.m_cf.Flags &= ~CF_EFFECTS;

    if (fontdlg.DoModal() == IDOK)
        fontdlg.GetCurrentFont(&m_logfont);

    UpdateFontExample();
}
Exemplo n.º 7
0
//*****************************************************************************************
void CFontItem::OnClickButton (CPoint /*point*/)
{
	CBCGPGridCtrl* pGridCtrl = GetOwnerList();
	ASSERT_VALID (pGridCtrl);

	ASSERT_VALID (this);
	ASSERT_VALID (m_pWndInPlace);
	ASSERT (::IsWindow (m_pWndInPlace->GetSafeHwnd ()));

	m_bButtonIsDown = TRUE;
	Redraw ();

	CFontDialog dlg (&m_lf);

	if (m_Color != (COLORREF)-1)
	{
		dlg.m_cf.rgbColors = m_Color;
	}

	if (dlg.DoModal () == IDOK)
	{
		dlg.GetCurrentFont (&m_lf);
		m_Color = dlg.GetColor ();

		if (m_pWndInPlace != NULL)
		{
			m_pWndInPlace->SetWindowText (FormatProperty ());
		}
		else
		{
			m_varValue = (LPCTSTR) FormatProperty ();
		}
	}

	if (m_pWndInPlace != NULL)
	{
		m_pWndInPlace->SetFocus ();
	}
	else
	{
		pGridCtrl->SetFocus ();
	}

	m_bButtonIsDown = FALSE;
	Redraw ();
}