我有一个有2个值的表。 激活手机的值以及手机停用时的值。 我想知道这个电话在任何一个月的最后一天仍然活跃了多少次。
Table1
phone1 DateActivated DateDeactivated HowManyTimesLastDayOfMonth
123 3/1/2016 3/15/2016 0
456 3/10/2016 6/25/2016 3
789 5/25/2016 10/10/2016 5
答案 0 :(得分:1)
放大我的评论:
Private Sub growthChart_MouseEnter(sender As Object, e As EventArgs) Handles growthChart.MouseEnter
growthChart.Focus()
End Sub
Private Sub growthChart_MouseWheel(sender As Object, e As MouseEventArgs) Handles growthChart.MouseWheel
Try
With growthChart
If (e.Delta < 0) Then
.ChartAreas(0).AxisX.ScaleView.ZoomReset()
.ChartAreas(0).AxisY.ScaleView.ZoomReset()
End If
If (e.Delta > 0) Then
Dim xMin As Double = .ChartAreas(0).AxisX.ScaleView.ViewMinimum
Dim xMax As Double = .ChartAreas(0).AxisX.ScaleView.ViewMaximum
Dim yMin As Double = .ChartAreas(0).AxisY.ScaleView.ViewMinimum
Dim yMax As Double = .ChartAreas(0).AxisY.ScaleView.ViewMaximum
Dim posXStart As Double = (.ChartAreas(0).AxisX.PixelPositionToValue(e.Location.X) _
- ((xMax - xMin) _
/ 4))
Dim posXFinish As Double = (.ChartAreas(0).AxisX.PixelPositionToValue(e.Location.X) _
+ ((xMax - xMin) _
/ 4))
Dim posYStart As Double = (.ChartAreas(0).AxisY.PixelPositionToValue(e.Location.Y) _
- ((yMax - yMin) _
/ 4))
Dim posYFinish As Double = (.ChartAreas(0).AxisY.PixelPositionToValue(e.Location.Y) _
+ ((yMax - yMin) _
/ 4))
.ChartAreas(0).AxisX.ScaleView.Zoom(posXStart, posXFinish)
.ChartAreas(0).AxisY.ScaleView.Zoom(posYStart, posYFinish)
End If
End With
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Sub
我应该更好地解释一下。你采取first_day(DateActivated + 1)的原因是第二个日期(到下个月的第一天)需要确保它不是一整月 - 所以如果手机在3月1日被激活并在3月停用25日,它没有显示整整一个月。 FIRST_DAY(DateDeactivated + 1)的原因是为了确保在一个月的最后一天发生停用时计入总数。