|
ありがとうございます。
うまくいきました。
ところで、
Dim xMax As Single = CSng(e.ChartGraphics.GetPositionFromAxis("ChartArea1", AxisName.X, Chart1.ChartAreas(0).AxisX.Maximum)) Dim xMin As Single = CSng(e.ChartGraphics.GetPositionFromAxis("ChartArea1", AxisName.X, Chart1.ChartAreas(0).AxisX.Minimum)) Dim yMax As Single = CSng(e.ChartGraphics.GetPositionFromAxis("ChartArea1", AxisName.Y, Chart1.ChartAreas(0).AxisY.Minimum)) Dim yMin As Single = CSng(e.ChartGraphics.GetPositionFromAxis("ChartArea1", AxisName.Y, Chart1.ChartAreas(0).AxisY.Maximum))
Dim Width As Single = xMax - xMin Dim heigth As Single = yMax - yMin
Dim myRect As New RectangleF(xMin, yMin, Width, heigth) myRect = e.ChartGraphics.GetAbsoluteRectangle(myRect)
という方法と
Dim xMax As Single = CSng(Chart1.ChartAreas(0).AxisX.ValueToPixelPosition(Chart1.ChartAreas(0).AxisX.Maximum)) Dim xMin As Single = CSng(Chart1.ChartAreas(0).AxisX.ValueToPixelPosition(Chart1.ChartAreas(0).AxisX.Minimum)) Dim yMax As Single = CSng(Chart1.ChartAreas(0).AxisY.ValueToPixelPosition(Chart1.ChartAreas(0).AxisY.Minimum)) Dim yMin As Single = CSng(Chart1.ChartAreas(0).AxisY.ValueToPixelPosition(Chart1.ChartAreas(0).AxisY.Maximum))
Dim Width As Single = xMax - xMin Dim heigth As Single = yMax - yMin
Dim myRect As New RectangleF(xMin, yMin, Width, heigth)
という方法がありますが、違いはなんでしょうか?
Dim area As ChartArea = TryCast(e.ChartElement, ChartArea) If Not(area Is Nothing) Then ' ここで描画 End Ifを使わなかったとしても後者の方法は使えると思います。
前者はeを引数としていますが、 使い道があるのでしょうか?
|