谁有关于使用这个公共对话框的例子。。嘿嘿不太会用这个。怎么样把里面对应的选择的项目和相应的字联系起来请不吝赐教

解决方案 »

  1.   

    void CGraphicView::OnFont() 
    {
    // TODO: Add your command handler code here
    CFontDialog dlg;
    if(IDOK==dlg.DoModal())
    {
    if(m_font.m_hObject)
    m_font.DeleteObject();
    m_font.CreateFontIndirect(dlg.m_cf.lpLogFont);
    m_strFontName=dlg.m_cf.lpLogFont->lfFaceName;
    Invalidate();
    }
    }
    关键是掌握m_cf.lpLogFont这个结构体指针,到msdn查一下,有很多信息的
      

  2.   


    LOGFONT m_lFont;
        COLORREF m_cTextColor; m_cTextColor = RGB(0,0,0); m_lFont.lfHeight = 16;
        m_lFont.lfWidth = 0;
        m_lFont.lfEscapement = 0;
        m_lFont.lfOrientation = 0;
        m_lFont.lfWeight = FW_NORMAL;
        m_lFont.lfItalic = FALSE;
        m_lFont.lfUnderline = FALSE;
    m_lFont.lfStrikeOut = FALSE;
    m_lFont.lfCharSet = GB2312_CHARSET;
        m_lFont.lfOutPrecision = OUT_STROKE_PRECIS;
        m_lFont.lfClipPrecision = CLIP_STROKE_PRECIS;
        m_lFont.lfQuality = DRAFT_QUALITY;
        m_lFont.lfPitchAndFamily = VARIABLE_PITCH|FF_MODERN;
    strcpy(m_lFont.lfFaceName,"宋体");
     
    CFontDialog dlg;
        dlg.m_cf.lpLogFont = &m_lFont; dlg.m_cf.rgbColors = m_cTextColor;
    dlg.m_cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS ;      if(dlg.DoModal() == IDOK)
    {
    dlg.GetCurrentFont(&m_lFont);
    }
      

  3.   

    太感谢了受益匪浅*_*还有问题请教如果想把在CFontDialog上选的参数传给View类中OnDraw函数中的pDC请问怎么写代码啊???我会再送50分。。
      

  4.   

    你的CFontDialog在哪里做的啊?
    如果在doc里做的,用成员变量保存起来,然后在view中OnDraw()
    pDoc->成员变量就可以了
    总之用成员变量保存起来就OK