Announcement

Collapse
No announcement yet.

System Font Size

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

  • System Font Size

    I have my entire application working with window resize, with
    one "small?" problem. The COMBOBOX vertical dimension
    does not resize. It appears that the height of a COMBOBOX
    is determined by the system font. I'd like to change the size
    of the system font in my application based on a resized window
    (I'll set the factor in WM_Resize, maybe going between a range
    of 1/2 to 2 times the standard font size). Of course it should
    only change the current apllication window, not all open
    windows).

    The following program displays a COMBOBOX at 1:1 and would like
    to do it at 2:1 also.

    Can anyone give me help/advice on how to chnage the size of
    the font used in combox (and everywhere else the system
    font is used in a given application).

    ---------------------------------------------------------------
    #COMPILE EXE
    #INCLUDE "Win32Api.Inc"
    %ID_ComboBox1 = 401
    %ID_ComboBox2 = 402
    FUNCTION PBMAIN()
    LOCAL hDlg AS LONG
    LOCAL AuditCount AS LONG
    DIM Listing(1:3) AS STRING
    Listing(1)="aaaaaaaa"
    Listing(2)="bbbbbbbbb"
    Listing(3)="cccccccc":
    DIALOG NEW 0,"Font Size Test",0,0,200,200,%DS_CENTER OR %WS_SYSMENU TO hDlg
    CONTROL ADD COMBOBOX,hDlg,%ID_ComboBox1,Listing(),10,10,80,50,%CBS_DROPDOWNLIST
    COMBOBOX SELECT hDlg,%ID_ComboBox1,1
    CONTROL ADD COMBOBOX,hDlg,%ID_ComboBox2,Listing(),10,60,160,100,%CBS_DROPDOWNLIST
    COMBOBOX SELECT hDlg,%ID_ComboBox2,2
    DIALOG SHOW MODAL hDlg
    END FUNCTION

  • #2
    Look up the createfont function in the win32 help file for details on types of fonts available.

    Code:
     
    'double combobox size, increase system font size
     
    #COMPILE EXE
    #INCLUDE "Win32Api.Inc"
     
    %ID_ComboBox1 = 401
    %ID_ComboBox2 = 402
     
    GLOBAL hComboBox AS LONG
    GLOBAL hMyFont   AS LONG
     
    FUNCTION PBMAIN()
     
    LOCAL hDlg AS LONG
    LOCAL AuditCount AS LONG
    DIM Listing(1:3) AS STRING
     
    Listing(1)="aaaaaaaa"
    Listing(2)="bbbbbbbbb"
    Listing(3)="cccccccc":
     
    DIALOG NEW 0,"Font Size Test",0,0,200,200,%DS_CENTER OR %WS_SYSMENU TO hDlg
     
    CONTROL ADD COMBOBOX,hDlg,%ID_ComboBox1,Listing(),10,10,80,50,%CBS_DROPDOWNLIST
     
    COMBOBOX SELECT hDlg,%ID_ComboBox1,1
     
    CONTROL ADD COMBOBOX,hDlg,%ID_ComboBox2,Listing(),10,60,160,100,%CBS_DROPDOWNLIST
     
    '---------------------------------------------------
    CONTROL HANDLE hDlg,%ID_ComboBox2 TO hComboBox
    
            hMyFont = CreateFont( _
              40,0, _   'height,width(default=0)
              0,0, _    'escapement(angle),orientation
              400, _    'weight (default=0,normal=400,bold=700)
              %FALSE, _ 'Italic
              %FALSE, _ 'Underline
              %FALSE, _ 'StrikeThru
              %ANSI_CHARSET, %OUT_CHARACTER_PRECIS, _
              %CLIP_DEFAULT_PRECIS, %PROOF_QUALITY, _
              %FIXED_PITCH OR %FF_MODERN,"Courier New" )
     
             Call SendMessage(hComboBox, %WM_SETFONT, hMyFont, 0)
       
    '---------------------------------------------------
    COMBOBOX SELECT hDlg,%ID_ComboBox2,2
     
    DIALOG SHOW MODAL hDlg
     
    END FUNCTION
    Have a great weekend!

    Regards, Jules
    Best regards
    Jules
    www.rpmarchildon.com

    Comment


    • #3
      Thanks so much Jules. So nice of you to take the time to
      help out. This is a great forum!

      Aloha,

      Joe Speroni
      Lawai, Hawaii

      ------------------

      Comment

      Working...
      X