Results 1 to 3 of 3

Thread: changing fontsize

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    changing fontsize

    Hi,

    I have a command button and a textbox.

    When the command button is pressed, I want font size to increase. Currently I have:

    Private Sub Command1_Click()
    Text1.FontSize = Text1.FontSize + 2
    End Sub

    This works to a point, but in the fontproperty of my textbox optional fontsizes are 8,10,12,14,18,24. So the font won't increase after 14 (because there is no 16 option).

    Rather than having Text1.FontSize + 2, how do I code it so that it moves to the next biggest fontsize?

    Thanks.

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    What about using the common dialog control...
    VB Code:
    1. Private Const comdiafontflagScreen As String = cdlCFScreenFonts
    2. Private Const comdiafontflagPrinter As String = cdlCFPrinterFonts
    3. Private Const comdiafontflagBoth As String = cdlCFBoth
    4.  
    5. Private Sub Command1_Click()
    6.     With CommonDialog1
    7.         .Flags = comdiafontflagScreen
    8.         .ShowFont
    9.        
    10.         Text1.FontSize = .FontSize
    11.     End With
    12. End Sub

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3
    Fanatic Member laserman's Avatar
    Join Date
    Jan 2002
    Location
    Wales U.K
    Posts
    775

    FONTSIZE

    TRY THIS LITTLE FONT SIZE CHANGER
    Attached Files Attached Files

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