How to set the x & y axis fontsize in MSChart
-
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 triedChart1.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 -
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 triedChart1.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 MichaelHi, 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.
-
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.
-
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?
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.
-
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.