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

Thread: Font -

  1. #1
    Join Date
    May 2007
    Posts
    680

    Exclamation Font -

    Sup guys,

    How would I forcefully set a font size in my program and not allow to change(so default font has no effect)?

    Thanks.
    Just sayin' but I'm 14(I'm telling you this so you know what sort of language to use).
    Advice received by a user.

  2. #2
    Join Date
    Nov 2007
    Posts
    129

    Smile Re: Font -

    Use LOGFONT with CreateFontIndirect.

    That should do it.
    It allows you to specify font size and it shouldn't change.

  3. #3
    Join Date
    May 2007
    Posts
    680

    Exclamation Re: Font -

    Thanks for that! Now, how would achieve the same result when you are creating a dialog? I mean, how do set a font so that the default font isn't used?

    Edit - Are there programs to create fonts? And if there are then could you use them using the function you mensioned?

    Thanks.
    Just sayin' but I'm 14(I'm telling you this so you know what sort of language to use).
    Advice received by a user.

  4. #4
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Font -

    You use the HFONT returned by CreateFont or CreateFontIndirect and supply it in a call to SelectObject. The other parameter of SelectObject HDC should be the Device Context of the dialog (as returned by GetDC).

  5. #5
    Join Date
    May 2007
    Posts
    680

    Re: Font -

    No I meant, how can I set the default font through the template? I'm pretty sure this is how people do it.
    Just sayin' but I'm 14(I'm telling you this so you know what sort of language to use).
    Advice received by a user.

  6. #6
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Font -

    Quote Originally Posted by .pcbrainbuster
    No I meant, how can I set the default font through the template?
    You should be more specific in your question, the next time around.

    You would right-click the dialog in Visual Studio editor and change the 'Font' property.
    Obvious, isn't it?

    Quote Originally Posted by .pcbrainbuster
    I'm pretty sure this is how people do it.
    Are you really so sure? What if the programmer needs to set a font that is not available on his programming environment?

  7. #7
    Join Date
    May 2007
    Posts
    680

    Re: Font -

    lol I would if I could; I don't use Visual C++ instead its Borland C++ Builder 6 Have you maybe got a link that may help me?

    Thank you!
    Just sayin' but I'm 14(I'm telling you this so you know what sort of language to use).
    Advice received by a user.

  8. #8
    Join Date
    May 2005
    Location
    Estonia
    Posts
    235

    Re: Font -

    You can change form font in Object Inspector.
    There is property combobox: "+Font (TFont)" Click on three dots button "..."
    There you can set the font you like.



    I suggest you to download free ebook and learn more about C++ builder, before asking questions here. Seems that you dont want to or dont know how to use Google.

    First result (PDF)
    http://www.google.ee/search?hl=et&q=...&btnG=Otsi&lr=


    Download and learn.
    Rate my post if i it was useful!

  9. #9
    Join Date
    May 2007
    Posts
    680

    Re: Font -

    That only works if you're working with forms...

    Any ideas?

    Thanks.
    Just sayin' but I'm 14(I'm telling you this so you know what sort of language to use).
    Advice received by a user.

  10. #10
    Join Date
    Nov 2007
    Posts
    129

    Smile Re: Font -

    You can use the same fonts for Dialogs.
    A dialog is just a kind of Window anyway.
    You can still use CreateFontIndirect, but you may have to go the way of custom dialogs - I'm not sure because I don't work much with Dialogs.

  11. #11
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Font -

    I mean, how do set a font so that the default font isn't used?
    WM_SETFONT

    No I meant, how can I set the default font through the template? I'm pretty sure this is how people do it.
    Code:
    IDD_MYDLG DIALOG 0, 0, 180, 120
    STYLE WS_POPUP | WS_CAPTION | DS_SETFONT
    CAPTION "Dialog"
    FONT 8, "MS Shell Dlg"
    BEGIN
    END
    Last edited by Igor Vartanov; February 22nd, 2008 at 03:58 AM.
    Best regards,
    Igor

  12. #12
    Join Date
    May 2007
    Posts
    680

    Re: Font -

    Thanks! RESOLVED
    Just sayin' but I'm 14(I'm telling you this so you know what sort of language to use).
    Advice received by a user.

  13. #13
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Font -

    Quote Originally Posted by .pcbrainbuster
    lol I would if I could; I don't use Visual C++ instead its Borland C++ Builder 6 Have you maybe got a link that may help me?

    Thank you!
    Your welcome. Here you go. http://msdn2.microsoft.com/en-us/vst.../aa700831.aspx

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured