Results 1 to 6 of 6

Thread: [2005] Help with imposting the size of the letters

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    5

    [2005] Help with imposting the size of the letters

    Hi,I'm new to this forum
    I would like to do a program style word pad.
    The open/save and new file dialog works perfectly but now how can I do that when I click on button the size of the letters to write will be 20?If you can please write here the code.I know my English is bad but I'm trying to talk

    Thanks in advance.
    Last edited by matthiasu; Jun 21st, 2007 at 11:23 AM.

  2. #2
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    Re: [2005] Help with imposting the size of the letters

    Add a numeric up down control to your form, and fill in the values for the size of the text you want them to be able to use. Detect when the value of the numeric updown changes and change the text size of your rich text box accordingly.

    D
    Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP

    Please Rate If I helped you.
    Please remember to mark threads as closed if your issue has been resolved.

    Reserved Words in Access | Connection Strings

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    5

    Re: [2005] Help with imposting the size of the letters

    Sorry but I didn't undertand.
    I have a textbox not a richtextbox.
    Is possible to do this in a textbox?
    If yes can you write here the code?

    Sorry and thanks in advance

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [2005] Help with imposting the size of the letters

    yes it is possible, simply set the textbox's Font property to a new Font that's a larger size

    Look into the TextBox class and the Font class at MSDN

    http://msdn2.microsoft.com/en-us/lib...trol.font.aspx
    http://msdn2.microsoft.com/en-us/lib...wing.font.aspx

    so you would want to do something like:
    TextBox1.Font = New Font("Microsoft Sans Serif", 12, FontStyle.Regular)
    or
    TextBox1.Font = New Font("Microsoft Sans Serif", 14, FontStyle.Regular)
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  5. #5
    Hyperactive Member NPassero's Avatar
    Join Date
    May 2007
    Location
    NJ
    Posts
    272

    Re: [2005] Help with imposting the size of the letters

    vb.net Code:
    1. Dim fontSize as Integer = 12
    2.  
    3. public sub buttonUP() handles button1.click
    4.    fontSize += 1
    5.    textbox1.Font = New Font("Microsoft Sans Serif", fontSize, FontStyle.Regular)
    6. end sub
    7.  
    8. public sub buttonDown() handles button2.click
    9.    fontSize -= 1
    10.    textbox1.Font = New Font("Microsoft Sans Serif", fontSize, FontStyle.Regular)
    11. end sub

    to change the size up and down using buttons
    *dont copy as is

    you can just do on a button click
    vb.net Code:
    1. textbox1.Font = New Font("Microsoft Sans Serif", 20, FontStyle.Regular)

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Help with imposting the size of the letters

    If you're imitating WordPad then presumably you are using a RichTextBox and you want to format only part of the text. In that case it would look like this:
    vb.net Code:
    1. myRichTextBox.SelectionFont = New Font(myRichTextBox.SelectionFont.FontFamily, newSizeHere, my.RichTextBox.SelectionFont.Style)
    Note that things get complex when you have already formatted two sections differently, then you select part of each section and try to format them as one block. You can lose some formatting on one or both blocks depending on the circumstances.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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