Announcement

Collapse
No announcement yet.

Easy Way for larger font?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Joe Speroni
    replied
    Thanks. The Dialog Font statement was exactly what I needed.

    All the other info is stuff I've tried before, but find it a little cumbersome and hard to debug. Here lack of knowledge of the Windows programming model hurts me. And remembering it between yearly uses of Windows.

    But finding stuff in the documentation is obviously another problem. It was right there but I couldn't see it.

    Thanks for taking the time to respond!

    Leave a comment:


  • Gösta H. Lovgren-2
    replied
    Joe, You may find this helpful. I #Include it at the top of my programs. Makes it pretty simple to set fonts (and sizes) for controls.

    Code:
    '------------------------------------------------------------------
    Function MakeFontEx(ByVal FontName As String, _
                        ByVal PointSize As Long, _
                        ByVal fBold As Long, _
                        ByVal fItalic As Long, _
                        ByVal fUnderline As Long) As Long
     
      ' Borrowed from Borje Hagsten
      ' MakeFontEx(FontName, PointSize, fBold, fItalic, fUnderline)
     
      Local hDC As Long, CyPixels As Long
     
      hDC = GetDC(%HWND_DESKTOP)
      CyPixels  = GetDeviceCaps(hDC, %LOGPIXELSY)
      ReleaseDC %HWND_DESKTOP, hDC
      PointSize = 0 - (PointSize * CyPixels) \ 72
     
      Function = CreateFont( _
                 PointSize, 0, _        'height, width(default=0)
                 0, 0, _                'escapement(angle), orientation
                 fBold, _               'weight (%FW_DONTCARE = 0, %FW_NORMAL = 400, %FW_BOLD = 700)
                 fItalic, _             'Italic
                 fUnderline, _          'Underline
                 %FALSE, _              'StrikeThru - who needs it?
                 %ANSI_CHARSET, %OUT_TT_PRECIS, _
                 %CLIP_DEFAULT_PRECIS, %DEFAULT_QUALITY, _
                 %FF_DONTCARE , ByCopy FontName)
     
     'Put below in Common_Locals code
    '     Local hFont_Arial As Dword
    '     Local hFont_Comic As Dword
    '     Local hFont_Courier As Dword
    '
    '       Examples:
    '  hFont_Courier = MakefontEx("Courier New", 12, %FW_NORMAL, %FALSE, %FALSE)
    '  hFont_Arial = MakefontEx("Arial", 10, %FW_Normal, %FALSE, %FALSE)
    '  hFont_Comic = MakefontEx("Comic MS Sans", 10, %FW_Normal, %TRUE,  %FALSE)
    '
    '       Change font in any control (textbox, label, etc.)
    '  Control Send hDlg, %IDC_TextBox1, %WM_SETFONT, hFont_Comic, 0
     
    ' Different Font Weights
    '%FW_DONTCARE   = 0
    '%FW_THIN       = 100
    '%FW_EXTRALIGHT = 200
    '%FW_LIGHT      = 300
    '%FW_NORMAL     = 400
    '%FW_MEDIUM     = 500
    '%FW_SEMIBOLD   = 600
    '%FW_BOLD       = 700
    '%FW_EXTRABOLD  = 800
    '%FW_HEAVY      = 900
    '
    '%FW_ULTRALIGHT = %FW_EXTRALIGHT
    '%FW_REGULAR    = %FW_NORMAL
    '%FW_DEMIBOLD   = %FW_SEMIBOLD
    '%FW_ULTRABOLD  = %FW_EXTRABOLD
    '%FW_BLACK      = %FW_HEAVY
     
    End Function
    '------------------------------------------------------------------
    ================================================================
    "Men have become the tools of their tools."
    Henry David Thoreau (1817-1862)
    ================================================================

    Leave a comment:


  • Dave Biggs
    replied
    Joe,
    See PB's help for DIALOG Font - sets the font for subsequent dialogs and their controls.

    To set the font for individual controls using 'CreateFontIndirect', see the example posted by William Burns..
    http://www.powerbasic.com/support/fo...ML/009014.html

    There's another couple of posts re: using 'CreateFont' by Eric Christensen here ..
    http://www.powerbasic.com/support/fo...ML/002285.html
    http://www.powerbasic.com/support/fo...ML/002986.html
    Last edited by Dave Biggs; 28 Oct 2007, 04:51 AM. Reason: Added link

    Leave a comment:


  • Joe Speroni
    started a topic Easy Way for larger font?

    Easy Way for larger font?

    I've a simple dialog Modal application that I would like to display larger font. Is there are simple way to change the Windows default font (for just this application) so that I can have bigger characters on the screen?

    Is there a simple way to set ALL fonts to larger size?

    Thanks for any help or suggestion.
Working...
X