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 set the x & y axis fontsize in MSChart

How to set the x & y axis fontsize in MSChart

Scheduled Pinned Locked Moved C#
helpgraphicstutorialquestion
5 Posts 2 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.
  • J Offline
    J Offline
    JohnQuar1
    wrote on last edited by
    #1

    I am having a problem setting the x & y axis fontsize in MSChart. I have played with the settings through the properties window, but when I run it, nothing changes. I can find out what the size currently is by typing: float size = Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont.SizeInPoints; and that will bring up a size of 8. I do not know how to then set the size to something I want. I've tried: Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont.Size.Equals(50); which does nothing, and I've also tried Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont.SizeInPoints = 10; which gives me an error of "Property or indexer 'System.Drawing.Font.SizeInPoints' cannot be assigned to -- it is read only" So does anyone know what I can type to set the axis? Thanks for your help! John Michael

    L 1 Reply Last reply
    0
    • J JohnQuar1

      I am having a problem setting the x & y axis fontsize in MSChart. I have played with the settings through the properties window, but when I run it, nothing changes. I can find out what the size currently is by typing: float size = Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont.SizeInPoints; and that will bring up a size of 8. I do not know how to then set the size to something I want. I've tried: Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont.Size.Equals(50); which does nothing, and I've also tried Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont.SizeInPoints = 10; which gives me an error of "Property or indexer 'System.Drawing.Font.SizeInPoints' cannot be assigned to -- it is read only" So does anyone know what I can type to set the axis? Thanks for your help! John Michael

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, in .NET some properties are read-only, i.e. you can get them but not set them. Most often then there also is a "bigger" property that can be set. Example: Form.Width is not settable, Form.Size is settable. In your particular case you have to set a new TitleFont. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      J 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, in .NET some properties are read-only, i.e. you can get them but not set them. Most often then there also is a "bigger" property that can be set. Example: Form.Width is not settable, Form.Size is settable. In your particular case you have to set a new TitleFont. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        J Offline
        J Offline
        JohnQuar1
        wrote on last edited by
        #3

        That makes sense, but I'm not sure how to do that b/c TitleFont is not a type. Could you give me an example?

        L 1 Reply Last reply
        0
        • J JohnQuar1

          That makes sense, but I'm not sure how to do that b/c TitleFont is not a type. Could you give me an example?

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Sorry no, I never used MSChart. Anyway, isn't TitleFont holding a Font instance? :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


          J 1 Reply Last reply
          0
          • L Luc Pattyn

            Sorry no, I never used MSChart. Anyway, isn't TitleFont holding a Font instance? :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


            J Offline
            J Offline
            JohnQuar1
            wrote on last edited by
            #5

            Its got a FontFamily, but once again, its a get property, does not have any set properties. I'll see if I can tinker with it some more and figure it out. Thank for your help! JM

            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