| ■77310 / ) |
Re[2]: Chartでマウスと共に移動する十字線 |
□投稿者/ ゆい (2回)-(2015/10/06(Tue) 23:04:52)
|
■No77297 (ぶなっぷ さん) に返信
ありがとうございます。
私のレベルではこんな感じかな? と思ったのですがこれでは、
'ChartGraphics' は 'System.Windows.Forms.MouseEventArgs' のメンバーではありません。
のエラー出てしまいます(^^;
Private Sub Chart1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Chart1.MouseMove
If Chart1.ChartAreas(0).AxisY.Minimum > 0 And Chart1.ChartAreas(0).AxisY.Maximum > 0 Then
Dim axx = Chart1.ChartAreas(0).AxisX
Dim axy = Chart1.ChartAreas(0).AxisY
Dim x1 = axx.ValueToPixelPosition(axx.Minimum) 'グラフ領域右端のX座標
Dim y1 = axy.ValueToPixelPosition(axy.Maximum) 'グラフ領域上部のY座標
Dim x2 = axx.ValueToPixelPosition(axx.Maximum) 'グラフ領域左端のX座標
Dim y2 = axy.ValueToPixelPosition(axy.Minimum) 'グラフ領域下部のY座標
e.ChartGraphics.Graphics.DrawLine(Pens.Gold, x1, CInt(y1), x1, CInt(y2))
e.ChartGraphics.Graphics.DrawLine(Pens.Gold, y1, CInt(x1), y1, CInt(x2))
End If
End Sub
|
|