Help with Fonts

Discussion in 'Programming General' started by tomanderson12, Oct 24, 2008.

Help with Fonts
  1. Unread #1 - Oct 24, 2008 at 1:35 PM
  2. tomanderson12
    Joined:
    Jan 21, 2008
    Posts:
    53
    Referrals:
    0
    Sythe Gold:
    0

    tomanderson12 Member

    Help with Fonts

    Hello, as some of you will know a while ago i made a Notepad it was fairly basic well I was bored today so i made a new one and moved things around, Then i decided i wanted to add a way to change the font.

    Its a RichtextBox rather than the normal Textbox But im completely stumped on starting this

    Any help will be appreciated.
     
  3. Unread #2 - Oct 24, 2008 at 11:31 PM
  4. loser4now
    Referrals:
    0

    loser4now Guest

    Help with Fonts

    Ok, if you are using vb6 it would lok something like this...

    Code:
     Text1.Font = calibri 
    All you need it the text box name, a .font after the name, and then the name of the font exactly like it is spelled in the font selection section.
     
  5. Unread #3 - Oct 30, 2008 at 10:38 AM
  6. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    Help with Fonts

    I don't have access to VB right now, but I'm almost 100% sure that you can use the Common Dialog control to open up the font dialog so the user can use all the fonts installed on their machine.

    Something like...

    Code:
    CommonDialog1.Font
    or something like
    CommonDialog1.FontDialog
    
    If you want me to elaborate on this a little more tell me.
     
  7. Unread #4 - Oct 30, 2008 at 8:55 PM
  8. demonavenger
    Joined:
    Feb 25, 2007
    Posts:
    536
    Referrals:
    0
    Sythe Gold:
    0

    demonavenger Forum Addict
    $5 USD Donor

    Help with Fonts

    Blupig is jus that little bit off, but since he doesn't have access to vb, we can cut him some slack :p

    This is prob something that you would use for common dialog's and selecting fonts:

    Code:
    With CommonDialog1 'open the with dialog
    .DialogTitle = "Font" 'set the dialog title
    .Flags = cdlCFBoth Or cdlCFEffects 'set the flags so you can
    'access the fonts* and the strikethru, underline, color
    
    .ShowFont 'show the dialog
    
    You can then use the information above to change the font in the Rich Text Box [RTB1]:

    Code:
    RTB1.SelFontName = CommonDialog1.FontName 'set the selected font’s name
    RTB1.SelFontSize = CommonDialog1.FontSize 'set the selected font’s size
    RTB1.SelBold = CommonDialog1.FontBold 'set the selected font’s bold property
    RTB1.SelItalic = CommonDialog1.FontItalic 'set the selected font’s italic property
    RTB1.SelStrikeThru = CommonDialog1.FontStrikethru 'set the selected font’s strikethrough property
    RTB1.SelUnderline = CommonDialog1.FontUnderline 'set the selected font’s underline property
    
    Hope that helped you mate :)
     
< Show Off | [TUT][C] Handling User Input >

Users viewing this thread
1 guest


 
 
Adblock breaks this site