Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to increase or decrease font size of control

How to increase or decrease font size of control

Scheduled Pinned Locked Moved C#
csharptutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    D i x y
    wrote on last edited by
    #1

    Hello friends, I am developing C#,NET windows application here i have a label now what i want that user can decrease or increase font size according to its requirement by selecting size from combo box. Thanks

    P H 2 Replies Last reply
    0
    • D D i x y

      Hello friends, I am developing C#,NET windows application here i have a label now what i want that user can decrease or increase font size according to its requirement by selecting size from combo box. Thanks

      P Offline
      P Offline
      phannon86
      wrote on last edited by
      #2

      What you want is to have a Font object assigned to myLabel.Font Have an event that fires when the selection in the comboBox is changed, get the value of the comboBox item that was selected and use it to see how big your font should be. e.g. Font myfont = new Font("Verdana", 12, FontStyle.Regular); Will create a font of size 12. Just adjust that value to your requirements.

      He who makes a beast out of himself gets rid of the pain of being a man

      R 1 Reply Last reply
      0
      • D D i x y

        Hello friends, I am developing C#,NET windows application here i have a label now what i want that user can decrease or increase font size according to its requirement by selecting size from combo box. Thanks

        H Offline
        H Offline
        Hamza Nadim
        wrote on last edited by
        #3

        Hello, here is another ,its much easier but its only when you are using (RichTextBox). add your items to the ComboBox (1,2,3,4,5) it actually means 1x,2x,3x,4x,5x. Code: private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { richTextBox1.ZoomFactor = float.Parse(comboBox1.Text); } try it Regards Hamza

        1 Reply Last reply
        0
        • P phannon86

          What you want is to have a Font object assigned to myLabel.Font Have an event that fires when the selection in the comboBox is changed, get the value of the comboBox item that was selected and use it to see how big your font should be. e.g. Font myfont = new Font("Verdana", 12, FontStyle.Regular); Will create a font of size 12. Just adjust that value to your requirements.

          He who makes a beast out of himself gets rid of the pain of being a man

          R Offline
          R Offline
          Roger Alsing 0
          wrote on last edited by
          #4

          And dont forget to dispose the old font if you use that approach.

          Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups