1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

MFC - CFontDialog

Discussion in 'Software Development' started by juryu, Sep 18, 2003.

Thread Status:
Not open for further replies.
  1. juryu

    juryu Thread Starter

    Joined:
    Feb 7, 2003
    Messages:
    18
    Hi people,

    I am having trouble initializing my CFontDialog with the font I want. Obviously

    CFontDialog * fd = new CFontDialog;
    fd->DoModal():

    shows the font dialog with no font selected.
    Now, I have a CFont * called ss_font, so I try this

    LOGFONT lf;
    ss_font->GetLogFont(&lf);
    CFontDialog * fd = new CFontDialog(&lf);
    fd->DoModal():

    And now it shows different values, but not the ones on my CFont!! For example, font size is something ridiculously big like 30000...

    So I thought maybe I need CHARFORMAT. I try creating a CHARFORMAT and putting all the values from my LOGFONT in it, and then calling

    CFontDialog * fd = new CFontDialog(&cfm);
    fd->DoModal():

    But then the compiler gives an error!!

    error C2664: '__thiscall CFontDialog::CFontDialog(struct tagLOGFONTA *,unsigned long,class CDC *,class CWnd *)' : cannot convert parameter 1 from 'struct _charformat *' to 'struct tagLOGFO
    NTA *'

    Duh, it obviously wanted a LOGFONT and not a CHARFORMAT. But then why didn't it show the correct values when I gave it the LOGFONT?

    Can anybody give me some help? I've already posted this in other forums and got no reply.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/165803

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice