CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: Setting Font of Buttons in CDialog through .rc file

  1. #1
    Join Date
    Sep 2019
    Posts
    34

    Setting Font of Buttons in CDialog through .rc file

    I have the following code in .rc file
    Code:
    FONT 12, "MS Shell Dlg"
    This code successfully sets the font of text inside the dialog(CDialog) to specifed face type but the font of text of buttons does not change.Anything missing to do that?

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,750

    Re: Setting Font of Buttons in CDialog through .rc file

    How are these buttons created? In the resources or dynamically?
    Victor Nijegorodov

  3. #3
    Join Date
    Sep 2019
    Posts
    34

    Re: Setting Font of Buttons in CDialog through .rc file

    Quote Originally Posted by VictorN View Post
    How are these buttons created? In the resources or dynamically?
    In the resource

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,750

    Re: Setting Font of Buttons in CDialog through .rc file

    And you don't additionally set/change buttons' font in the code. Do you?
    Victor Nijegorodov

  5. #5
    Join Date
    Sep 2019
    Posts
    34

    Re: Setting Font of Buttons in CDialog through .rc file

    No

  6. #6
    Join Date
    Sep 2019
    Posts
    34

    Re: Setting Font of Buttons in CDialog through .rc file

    I tried drilling down it and found that as soon as i declare button as CMFCBUTTON in .h file and compile code than font is not reflected. On other side if i dont declare it as CMFCBUTTON ,font gets reflected properly

  7. #7
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,750

    Re: Setting Font of Buttons in CDialog through .rc file

    Quote Originally Posted by Sparsh_21j View Post
    I tried drilling down it and found that as soon as i declare button as CMFCBUTTON in .h file and compile code than font is not reflected. On other side if i dont declare it as CMFCBUTTON ,font gets reflected properly
    Have a look at MSDN: you seem to need calling EnableMenuFont method (only a guess. cause I never used the CMFCButton class!)
    Victor Nijegorodov

  8. #8
    Join Date
    Sep 2019
    Posts
    34

    Re: Setting Font of Buttons in CDialog through .rc file

    That doesn't worked

  9. #9
    Join Date
    Jun 2020
    Posts
    1

    Re: Setting Font of Buttons in CDialog through .rc file

    It does not work

  10. #10
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,750

    Re: Setting Font of Buttons in CDialog through .rc file

    Quote Originally Posted by Sparsh_21j View Post
    That doesn't worked
    Then set the dialog font for this CMFCButton.
    Add this line on your OnInitDialog override:
    Code:
    ...
    {
       CDialog::OnInitDialog();
       
       myMFCButton.SetFont(GetFont());
       ...
    }
    where myMFCButton is the member variable of your CMFCButton.
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)