4,815
社区成员




Chart1.ChartAreas["ChartArea1"].AxisX.LabelAutoFitMaxFontSize=5;
CustomLabel myCustomLabel1 = new CustomLabel();
myCustomLabel1.Text = "工作服";
myCustomLabel1.FromPosition = 0.5;
myCustomLabel1.ToPosition = 1.5;
myCustomLabel1.RowIndex = 1;
myCustomLabel1.LabelMark = LabelMarkStyle.SideMark;
myCustomLabel1.ForeColor = System.Drawing.Color.FromArgb(255, 0, 0, 0);
Chart1.ChartAreas["ChartArea1"].AxisX.CustomLabels.Add(myCustomLabel1);
myCustomLabel1.Axis.LabelAutoFitMaxFontSize = 10;//放在前面一行不行,说未实列化对象
CustomLabel myCustomLabel2 = new CustomLabel();
myCustomLabel2.Text = "工作裤";
myCustomLabel2.FromPosition = 1.5;
myCustomLabel2.ToPosition = 2.5;
myCustomLabel2.RowIndex = 1;
myCustomLabel2.LabelMark = LabelMarkStyle.SideMark;
myCustomLabel2.ForeColor = System.Drawing.Color.FromArgb(255, 0, 0, 0);
//myCustomLabel2.Axis.LabelStyle.Font = new Font("Arial", 7); 这里报错 未将对象实列化
Chart1.ChartAreas["ChartArea1"].AxisX.CustomLabels.Add(myCustomLabel2);
//myCustomLabel2.Axis.LabelStyle.Font = new Font("Arial", 7);这里设置是全部的都变了。