我正在使用 .net char 控件创建图表图形。我的问题是,如果我不使用白色或透明背景,值标签和轴标签总是粗体!
.ChartAreas(0).AxisY.LabelStyle.Font = New Drawing.Font("Arial", 8.0F, FontStyle.Regular)
我将字体设置为常规字体,但它仅在我的白色背景上显示为常规字体。我正在从白色到灰色交替背景。灰色的字体总是粗体。
有什么建议么?
Dim myChart As New Chart
With myChart
.Width = 685 + 130
.Height = 45 + letzteZusatz * 2
.RenderType = RenderType.ImageTag
.AntiAliasing = AntiAliasingStyles.All
.TextAntiAliasingQuality = TextAntiAliasingQuality.High
If white Then
.BackColor = Color.FromArgb(100, 252, 252, 252)
white = False
Else
.BackColor = Color.FromArgb(100, 220, 220, 220)
white = True
End If
.ChartAreas.Add("ChartArea1")
.ChartAreas("ChartArea1").Area3DStyle.Enable3D = False
With .ChartAreas(0)
.BackColor = Color.Transparent
.BorderWidth = 0
.AxisX.LineWidth = 0
.AxisY.LineWidth = CType((0 + (letzteZusatz * 0.1)), Integer)
.AxisY.LineColor = Color.FromArgb(100, 194, 195, 192)
.AxisY.Minimum = minimum
.AxisY.Maximum = CType(maximum * 1.1, Integer)
.AxisX.LabelStyle.Enabled = False
.AxisY.LabelStyle.Enabled = True
.AxisY.LabelStyle.Angle = 0
.AxisY.LabelStyle.Format = "N0"
.AxisY.LabelStyle.Font = New Drawing.Font("Arial", 8.0F, FontStyle.Regular)
.AxisY.IsLabelAutoFit = False
.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None
.AxisX.MajorGrid.Enabled = False
.AxisY.MajorGrid.Enabled = True
.IsSameFontSizeForAllAxes = True
.AxisY.MajorGrid.LineColor = Color.FromArgb(100, 194, 195, 192)
.AxisY.MajorTickMark.Enabled = True
.AxisY.MinorTickMark.Enabled = False
.AxisX.MajorTickMark.Enabled = False
.AxisX.MinorTickMark.Enabled = False
.AxisY.MajorTickMark.LineColor = Color.FromArgb(100, 194, 195, 192)
.BorderWidth = 0
.AlignmentOrientation = AreaAlignmentOrientations.Vertical
.InnerPlotPosition = New ElementPosition(16, 0, 84, CType((100 - (letzteZusatz * 3)), Single))
End With
.DataBindTable(BuildChartTabel(o, seite), "Name")
For Each s As Series In myChart.Series
s.ChartType = SeriesChartType.Bar
s.BorderWidth = 0
s.MarkerSize = 0
s.IsValueShownAsLabel = True
s("PixelPointWidth") = "45"
For Each p As DataPoint In s.Points
p.BackImage = "~/img/bg_chart.png"
p.BackImageWrapMode = ChartImageWrapMode.Tile
p.BorderWidth = 0
p.MarkerSize = 0
Next
Next
End With
Using chartimage = New FileStream("D:\test.png", FileMode.Create)
myChart.SaveImage(chartimage, ChartImageFormat.Png)
chartimage.Flush()
End Using