Files
Desktop_DevIceparsingDataLog/Form1.vb
2025-12-11 11:02:58 +08:00

1212 lines
48 KiB
VB.net
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Imports FlexCell
Imports Steema.TeeChart
Public Class Form1
Public filepath As String
Public GdbConnString As String
Public linglist As Dictionary(Of String Steema.TeeChart.Styles.Line)
Private _axis As List(Of Steema.TeeChart.Axis)
Private _fastLine As Dictionary(Of String, Steema.TeeChart.Styles.FastLine)
Private _curSor(1) As Steema.TeeChart.Tools.CursorTool
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
filepath = $"{Application.StartupPath }\config.flx"
GdbConnString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Port=3307;Database=psmysql;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;"
' 假设你的TeeChart控件名为tcChart
AddHandler ChartBar.MouseWheel, AddressOf tcChart_ChartMouseWheel
ChartBar.Zoom.ZoomPercent(130)
_axis = New List(Of Axis)
_fastLine = New Dictionary(Of String, Styles.FastLine)
init_Grid_config()
FileTo_Grid_config()
linglist = New Dictionary(Of String, Steema.TeeChart.Styles.Line)
'initChartBar(10, 1701747214, 1704822658)
'Testfunction()
'ksjfk()
GetDevtype()
End Sub
' 事件处理程序
Private Sub tcChart_ChartMouseWheel(sender As Object, e As MouseEventArgs)
' 在这里添加你的逻辑
' 例如根据e.Delta判断滚轮滚动方向
Dim tx ty As Integer
If IsNothing(_fastLine) OrElse _fastLine.Count = 0 Then Return
Dim fl = _fastLine.Values(0)
If e.Delta > 0 Then
'MessageBox.Show("鼠标向上滚动")
'tx = ChartBar.Zoom.
' ty =
' ChartBar.Zoom.ZoomRect(New Rectangle(0, 50, ChartBar.Width, 100))
' If ChartBar.Zoom.HistorySteps.Count > 0 Then
'ChartBar.Zoom.Undo()
'Else
ChartBar.Zoom.ZoomRect(New Rectangle(0, 0, ChartBar.Width, ChartBar.Height))
' Console.WriteLine($"鼠标向上滚动{ChartBar.Width},{ChartBar.Height}")
'' End If
'Dim rectc = ChartBar.RectangleToClient(New Rectangle(0, 0, ChartBar.Width, ChartBar.Height))
'Console.WriteLine(fl.Chart.ChartRect.X)
Else
'MessageBox.Show("鼠标向下滚动")
ChartBar.Zoom.Undo()
' fl = _fastLine.Item(node.Key)
'If ChartBar.Zoom.HistorySteps.Count > 0 Then
' ChartBar.Zoom.Undo()
' Console.WriteLine($"鼠标向上滚动_Undo")
'Else
' ChartBar.Zoom.ZoomRect(New Rectangle((ChartBar.Width / 2) - 300, 0, (ChartBar.Width / 2) + 100, ChartBar.Height))
' Console.WriteLine($"鼠标向上滚动{(ChartBar.Width / 2) - 100},{(ChartBar.Width / 2) + 200}")
'End If
'ChartBar.Zoom.ZoomRect(New Rectangle(100, 100, 120, 120))
End If
'Dim X As Integer = Points1.CalcXPos(2)
'Dim Y As Integer = TChart1.Axes.Left.CalcYPosValue(TChart1.Axes.Left.MaxYValue)
'Dim Height As Integer = TChart1.Axes.Left.CalcYPosValue(TChart1.Axes.Left.MinYValue) - TChart1.Axes.Left.CalcYPosValue(TChart1.Axes.Left.MaxYValue)
'Dim Width As Integer = Points1.CalcXPos(5) - X
'Dim R As New Rectangle(X, Y, Width, Height)
'TChart1.Zoom.ZoomRect(R)
End Sub
Public devnamedic As List(Of String)
Public Sub GetDevtype()
devnamedic = New List(Of String)
Dim selectstr As String = "SELECT DEV_NAME
FROM `psmysql`.`deviceparsingdatalog`
GROUP BY DEV_NAME"
Dim dt As DataTable
Try
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mysql, GdbConnString)
db.Open()
dt = db.ExecuteDataTable(selectstr)
If IsNothing(dt) OrElse dt.Rows.Count = 0 OrElse dt.Columns.Count = 0 Then
MsgBox($"数据查询失败!!!{vbCrLf }原因:{vbCrLf }数据查询语句异常:{selectstr}")
Else
For i = 0 To dt.Rows.Count - 1
devnamedic.Add(dt(i)(0))
Next
End If
End Using
Catch ex As Exception
MsgBox($"数据查询失败!!!{vbCrLf }原因:{vbCrLf }{ex.Message }")
Return
End Try
End Sub
Private Sub InitPieChart(kkdic As Dictionary(Of String Dictionary(Of String, Double)), starttime As Date stoptime As Date)
InitTeeChart(kkdic, starttime, stoptime)
Dim fl As Steema.TeeChart.Styles.FastLine
Dim tval As Dictionary(Of String, Double)
Dim yt, yn As DateTime
Dim sp = stoptime - starttime
Dim dtOffset As New DateTimeOffset(starttime)
Dim tstr As String
Dim tstfsr As String
For Each node In kkdic
'Console.WriteLine($"{node.Key}")
For t = 0 To sp.TotalSeconds
fl = _fastLine.Item(node.Key)
tval = node.Value
yt = dtOffset.AddSeconds(t)).LocalDateTime
tstr = $"{yt.Year }/{yt.Month }/{yt.Day } {yt.Hour }:{yt.Minute }:{yt.Second }"
If t <> 0 Then
yn = dtOffset.AddSeconds(t - 1)).LocalDateTime
tstfsr = $"{yn.Year }/{yn.Month }/{yn.Day } {yn.Hour }:{yn.Minute }:{yn.Second }"
End If
If tval.ContainsKey(tstr) Then
If t = 0 OrElse Not (tval.Item(tstr) <> tval.Item(tstfsr)) Then
Else
fl.Add(yt.ToOADate, tval.Item(tstfsr))
End If
fl.Add(yt.ToOADate, tval.Item(tstr))
'Console.WriteLine($"{tstr}:{ tval.Values(t)}")
Else
If Date.Parse(tstr) < Date.Parse(tval.Keys(0)) Then
If tval.Values(0) = 1 Then
fl.Add(yt.ToOADate, 0)
tval.Add(tstr, 0)
' Console.WriteLine($"{tstr}:0")
ElseIf tval.Values(0) = 0 Then
fl.Add(yt.ToOADate, 1)
tval.Add(tstr, 1)
' Console.WriteLine($"{tstr}:1")
Else
fl.Add(yt.ToOADate, 0.5)
tval.Add(tstr, 0.5)
'Console.WriteLine($"{tstr}:0.5")
End If
Else
If tval.Item(tstfsr) = 1 Then
fl.Add(yt.ToOADate, 1)
tval.Add(tstr, 1)
' Console.WriteLine($"{tstr}:1")
ElseIf tval.Item(tstfsr) = 0 Then
fl.Add(yt.ToOADate, 0)
tval.Add(tstr, 0)
' Console.WriteLine($"{tstr}:0")
Else
fl.Add(yt.ToOADate, 0.5)
tval.Add(tstr, 0.5)
' Console.WriteLine($"{tstr}:0.5")
End If
End If
End If
Next
Next
End Sub
Private Sub InitPieChart(kkdic As Dictionary(Of String Dictionary(Of Long, Double)), starttime As Long stoptime As Long)
InitTeeChart(kkdic, starttime, stoptime)
Dim fl As Steema.TeeChart.Styles.FastLine
Dim tval As Dictionary(Of Long, Double)
Dim dtOffset As New DateTimeOffset(New DateTime(1970, 1, 1, 0, 0, 0))
' 获取本地日期和时间
Dim yt As DateTime
For t = starttime To stoptime
For Each node In kkdic
fl = _fastLine.Item(node.Key)
tval = node.Value
yt = dtOffset.AddSeconds(t)).LocalDateTime
If tval.ContainsKey(t) Then
If t = starttime OrElse Not (tval.Item(t) = tval.Item(t - 1)) Then
Else
fl.Add(yt.ToOADate, tval.Item(t - 1))
'Console.WriteLine($"{yt.ToOADate}:{ tval.Item(t - 1)}")
End If
fl.Add(yt.ToOADate, tval.Item(t))
'Console.WriteLine($"{yt.ToOADate}:{ tval.Item(t)}")
''Console.WriteLine(DateTime.FromOADate(yt.ToOADate).ToString("yyyy-MM-dd HH:mm:ss"))
'#1/16/2024 01:09:47 AM#
Else
If t < tval.Keys(0) Then
If tval.Values(0) = 1 Then
fl.Add(yt.ToOADate, 0)
tval.Add(t, 0)
'Console.WriteLine($"{yt.ToOADate}:0")
ElseIf tval.Values(0) = 0 Then
fl.Add(yt.ToOADate, 1)
tval.Add(t, 1)
'Console.WriteLine($"{yt.ToOADate}:1")
Else
fl.Add(yt.ToOADate, 0.5)
tval.Add(t, 0.5)
'Console.WriteLine($"{yt.ToOADate}:0.5")
End If
Else
If tval.Item(t - 1) = 1 Then
fl.Add(yt.ToOADate, 1)
tval.Add(t, 1)
'Console.WriteLine($"{yt.ToOADate}:1")
ElseIf tval.Item(t - 1) = 0 Then
fl.Add(yt.ToOADate, 0)
tval.Add(t, 0)
'Console.WriteLine($"{yt.ToOADate}:0")
Else
fl.Add(yt.ToOADate, 0.5)
tval.Add(t, 0.5)
'Console.WriteLine($"{yt.ToOADate}:0.5")
End If
End If
End If
Next
Next
End Sub
Public Sub initChartBar(tCounta As Integer, starttime As Double, stoptime As Double)
'Dim devline = AddTeeChartStylesLine()
ChartBar.Header.Text = "" '标题
ChartBar.Header.Visible = True
ChartBar.Legend.Transparent = False '刻印说明
' ChartBar.Legend.Alignment = Steema.TeeChart.LegendAlignments.Top
ChartBar.Aspect.View3D = False
ChartBar.Axes.Left.Automatic = True
ChartBar.Axes.Left.AutomaticMaximum = True
ChartBar.Axes.Left.AutomaticMinimum = True
ChartBar.Axes.Left.Labels.ValueFormat = "0.0"
ChartBar.Axes.Left.Increment = 0.5
ChartBar.Axes.Left.Labels.LabelHeight(10)
'ChartBar.Axes.Left.Scroll(15, True)
'ChartBar.Axes.Left.Labels.Exponent = True
'Line1.Clear()
'ChartBar.Axes.
ChartBar.Axes.Bottom.AutomaticMaximum = False
ChartBar.Axes.Bottom.AutomaticMinimum = False
ChartBar.Axes.Bottom.Automatic = False
ChartBar.Axes.Bottom.Increment = 1
ChartBar.Axes.Bottom.Maximum = stoptime
'ChartBar.Axes.Bottom.Minimum = starttime
'ChartBar.Axes.Bottom.Labels.Width = 20
'ChartBar.Axes.Bottom.Labels.DateTimeFormat = "HH:mm:ss"
'ChartBar.Series(0).XValues.DateTime = False
'ChartBar.Axes.Bottom.MaxXValue = stoptime
'ChartBar.Axes.Bottom.ma = stoptime
'ChartBar.Axes.Bottom.Scroll(1705386785, False)
'ChartBar.Axes.Bottom.Scroll()
'ChartBar.Zoom.ZoomRect(New Rectangle(0, 0, 1000, 1000))
Dim ftemp = tCounta
ChartBar.Axes.Left.Maximum = ftemp ' / 100
ChartBar.Axes.Left.Minimum = 0 '/ 100
ChartBar.Axes.Bottom.Labels.Align = -45
ChartBar.Axes.Bottom.Labels.MultiLine = True
'Dim X As Integer = ChartBar
'Dim R As New Rectangle(X, Y, Width, Height)
' ChartBar.Refresh()
End Sub
Public Sub Testfunction()
ChartBar.Header.Text = "" '标题
ChartBar.Header.Visible = True
ChartBar.Aspect.View3D = False
ChartBar.Axes.Left.Automatic = False
ChartBar.Axes.Left.AutomaticMaximum = False
ChartBar.Axes.Left.AutomaticMinimum = False
ChartBar.Axes.Left.Labels.ValueFormat = "0.0"
ChartBar.Axes.Left.Increment = 0.5
ChartBar.Axes.Left.Maximum = 10 ' / 100
ChartBar.Axes.Left.Minimum = 0 '/ 100
ChartBar.Axes.Bottom.AutomaticMaximum = False
ChartBar.Axes.Bottom.AutomaticMinimum = False
ChartBar.Axes.Bottom.Automatic = False
ChartBar.Axes.Bottom.Labels.Align = -45
ChartBar.Axes.Bottom.Labels.MultiLine = True
ChartBar.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM-dd"
ChartBar.Series(0).XValues.DateTime = True
' 创建 DateTimeOffset 对象并设置其值为指定的 UTC 秒数
Dim dtOffset As New DateTimeOffset(New DateTime(1970, 1, 1), TimeSpan.Zero)
' 获取本地日期和时间
Dim yt As DateTime = dtOffset + TimeSpan.FromSeconds(1704822366)).LocalDateTime
Dim minValue As DateTime = New DateTime(yt.Year, yt.Month, yt.Day, yt.Hour, yt.Minute yt.Second) '' 最小日期
yt = dtOffset + TimeSpan.FromSeconds(1704823530)).LocalDateTime
Dim maxValue As DateTime = New DateTime(yt.Year, yt.Month, yt.Day, yt.Hour, yt.Minute yt.Second) '' 最小日期
ChartBar.Axes.Bottom.Maximum = maxValue.ToOADate
ChartBar.Axes.Bottom.Minimum = minValue.ToOADate
'Dim dou As Double = 1 / (maxValue.ToOADate - minValue.ToOADate)
'ChartBar.Axes.Bottom.Increment = TimeSpan.FromSeconds(1).TotalSeconds
End Sub
Public Sub ksjfk()
' 创建TeeChart控件对象
Dim chart = ChartBar.Chart
' 添加Series到图表上这里使用Line Series作示例
Dim series As New Steema.TeeChart.Styles.Line()
'chart.Add(series)
ChartBar.Series.Add(series)
' 定义要显示的数据点及其相应的X轴标签
Dim xDataPoints() As Double = {10, 20, 30, 40} ' X轴数据点
Dim yDataPoints() As Double = {50, 60, 70, 80} ' Y轴数据点
Dim labels() As String = {"Label1", "Label2", "Label3", "Label4"} ' X轴标签
' 遍历数据并设置每个数据点的值和标签
For i As Integer = 0 To xDataPoints.Length - 1
Dim point As New PointF(xDataPoints(i), yDataPoints(i))
' 设置X轴标签
point.X = labels(i)
' 向系列中添加数据点
series.Add(point)
Next
' 显示图表
'chart.ShowDialog()
End Sub
Public Function AddTeeChartStylesLine() As Styles.Line
Dim devline As Steema.TeeChart.Styles.Line = New Styles.Line
ChartBar.Series.Add(devline)
Dim minValue As DateTime = New DateTime(2024, 1, 10, 2, 35 30) '' 最小日期
Return devline
' Dim chart As TChart = ChartBar
End Function
Public Sub init_Grid_config()
With Grid_config
.NewFile()
.Cols = 3
.Rows = 7
.DisplayRowNumber = False
.Cell(0, 0).Text = "序号"
.Cell(0, 1).Text = "属性"
.Cell(0, 2).Text = "属性值"
.Column(0).Width = 0
.Column(1).Width = 150
.Column(1).Locked = True
.Column(2).Width = 200
.Column(1).Alignment = AlignmentEnum.CenterCenter
.Column(2).Alignment = AlignmentEnum.CenterCenter
.Cell(1, 1).Text = "开始时间"
.Cell(2, 1).Text = "结束时间"
.Cell(3, 1).Text = "机型"
.Cell(4, 1).Text = "界面宽度"
.Cell(5, 1).Text = "界面高度"
.Cell(6, 1).Text = "左右比例"
.Cell(1, 2).CellType = CellTypeEnum.DateTime
.Cell(2, 2).CellType = CellTypeEnum.DateTime
.Cell(3, 2).CellType = CellTypeEnum.ComboBox
.Row(4).Visible = False
.Row(5).Visible = False
.Row(6).Visible = False
End With
End Sub
Public Sub FileTo_Grid_config()
If IO.File.Exists(filepath) Then
Grid_config.OpenFile(filepath)
Dim kk As Integer = 0
Dim kr As Integer = 0
If Integer.TryParse(Grid_config.Cell(4, 2).Text, kk) And Integer.TryParse(Grid_config.Cell(5, 2).Text, kr) Then
If kk <> 0 And kr <> 0 Then
Size = New Size(kk, kr)
End If
End If
kk = 0
If Integer.TryParse(Grid_config.Cell(6, 2).Text, kk) Then
If kk <> 0 Then
SplitContainer1.SplitterDistance = kk
End If
End If
End If
End Sub
Public Sub Grid_config_FileTo()
Grid_config.Cell(4, 2).Text = Size.Width
Grid_config.Cell(5, 2).Text = Size.Height
Grid_config.Cell(6, 2).Text = SplitContainer1.SplitterDistance
Grid_config.SaveFile(filepath)
End Sub
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
Grid_config_FileTo()
End Sub
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
Grid_config.AddItem("")
Grid_config.Cell(Grid_config.Rows - 1, 1).Text = "机型"
End Sub
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click
Grid_configDeleteRow(Grid_config.ActiveCell.Row)
End Sub
Public Sub Grid_configDeleteRow(erow As Integer)
Dim devname As String = Grid_config.Cell(erow, 1).Text
If devname.Equals("机型") Then
Grid_config.Row(erow).Delete()
End If
End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
init_Grid_config()
End Sub
Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs) Handles ToolStripButton4.Click
MysqlDataDispose()
End Sub
Public Sub MysqlDataDispose()
Dim selectstr As String = "SELECT * FROM `psmysql`.`deviceparsingdatalog` WHERE"
Dim cstrpar As String = String.Empty
Dim starttime, stoptime As DateTime
Dim dtZone As DateTime = New DateTime(1970, 1, 1, 0, 0, 0)
Try
starttime = DateTime.Parse(Grid_config.Cell(1, 2).Text.Trim)
stoptime = DateTime.Parse(Grid_config.Cell(2, 2).Text.Trim)
If IsNothing(starttime) OrElse IsNothing(stoptime) Then
MsgBox($"数据查询失败!!!{vbCrLf }原因:{vbCrLf }日期输入错误")
Return
End If
Catch ex As Exception
MsgBox($"数据查询失败!!!{vbCrLf }原因:{vbCrLf }日期输入错误")
Return
End Try
For i = 1 To Grid_config.Rows - 1
If i = 1 Then
selectstr = $"{selectstr}`DateTime`>='{starttime.Year }/{starttime.Month }/{starttime.Day } {starttime.Hour }:{starttime.Minute }:{starttime.Second }' And "
ElseIf i = 2 Then
selectstr = $"{selectstr}`DateTime`<='{stoptime.Year }/{stoptime.Month }/{stoptime.Day } {stoptime.Hour }:{stoptime.Minute }:{stoptime.Second }' And "
ElseIf i = 3 Then
cstrpar = $"{cstrpar}OR `DEV_NAME` = '{Grid_config.Cell(i, 2).Text.Trim}'{vbCrLf }"
End If
Next
If Not String.IsNullOrEmpty(cstrpar) Then
cstrpar = cstrpar.Remove(0, 2)
selectstr = $"{selectstr}({cstrpar.Trim }) ORDER BY (`DateTime`) ASC"
End If
' Dim rowdic As Dictionary(Of String, Dictionary(Of String, String)) = New Dictionary(Of String, Dictionary(Of String, String))
Dim colounmdic As Dictionary(Of String Dictionary(Of String, Double)) = New Dictionary(Of String, Dictionary(Of String, Double))
Dim dt As DataTable
Dim rval As Double = 0
Try
Using db As New DbExecutor(DbExecutor.DbTypeEnum.Mysql, GdbConnString)
db.Open()
dt = db.ExecuteDataTable(selectstr)
If IsNothing(dt) OrElse dt.Rows.Count = 0 OrElse dt.Columns.Count = 0 Then
MsgBox($"数据查询失败!!!{vbCrLf }原因:{vbCrLf }数据查询语句异常:{selectstr}")
Return
Else
Dim sqldate As Date
Dim timse As String
For i = 0 To dt.Rows.Count - 1
sqldate = Date.Parse(dt.Rows(i)("DateTime"))
timse = $"{sqldate.Year }/{sqldate.Month }/{sqldate.Day } {sqldate.Hour }:{sqldate.Minute }:{sqldate.Second }"
If i = 0 Then
starttime = sqldate
ElseIf i = dt.Rows.Count - 1 Then
stoptime = sqldate
End If
' Try
'If i = 558 Then
' Console.WriteLine(i)
' End If
If Not colounmdic.ContainsKey("Room_isExist") Then
colounmdic.Add("Room_isExist", New Dictionary(Of String, Double))
End If
If IsDBNull(dt.Rows(i)("Room_isExist")) Then
rval = 0
Else
Double.TryParse(dt.Rows(i)("Room_isExist"), rval)
End If
If colounmdic.Item("Room_isExist").ContainsKey(timse) Then
colounmdic.Item("Room_isExist").Item(timse) = rval
Else
colounmdic.Item("Room_isExist").Add(timse, rval)
End If
If Not colounmdic.ContainsKey("isExist_Gol") Then
colounmdic.Add("isExist_Gol", New Dictionary(Of String, Double))
End If
If IsDBNull(dt.Rows(i)("isExist_Gol")) Then
rval = 0
Else
Double.TryParse(dt.Rows(i)("isExist_Gol"), rval)
End If
If colounmdic.Item("isExist_Gol").ContainsKey(timse) Then
colounmdic.Item("isExist_Gol").Item(timse) = rval
Else
colounmdic.Item("isExist_Gol").Add(timse, rval)
End If
'Catch ex As Exception
' Console.WriteLine(i)
'End Try
' Try
For j = 1 To 5
selectstr = $"isExist_Area_{j}"
cstrpar = $"isTrig_{j}"
If Not colounmdic.ContainsKey(selectstr) Then
colounmdic.Add(selectstr, New Dictionary(Of String, Double))
End If
'Double.TryParse(dt.Rows(i)(selectstr), rval)
If IsDBNull(dt.Rows(i)(selectstr)) Then
rval = 0
Else
Double.TryParse(dt.Rows(i)(selectstr), rval)
End If
If colounmdic.Item(selectstr).ContainsKey(timse) Then
colounmdic.Item(selectstr).Item(timse) = rval
Else
colounmdic.Item(selectstr).Add(timse, rval)
End If
If Not colounmdic.ContainsKey(cstrpar) Then
colounmdic.Add(cstrpar, New Dictionary(Of String, Double))
End If
If IsDBNull(dt.Rows(i)(cstrpar)) Then
rval = 0
Else
Double.TryParse(dt.Rows(i)(cstrpar), rval)
End If
If colounmdic.Item(cstrpar).ContainsKey(timse) Then
colounmdic.Item(cstrpar).Item(timse) = rval
Else
colounmdic.Item(cstrpar).Add(timse, rval)
End If
Next
'Catch ex As Exception
' Console.WriteLine(i)
'End Try
Next
End If
End Using
InitPieChart(colounmdic, starttime, stoptime)
Catch ex As Exception
MsgBox($"数据查询失败!!!{vbCrLf }原因:{vbCrLf }{ex.Message }")
Return
End Try
End Sub
Public Sub initGrid_Mysqldate(rowdic As Dictionary(Of String, Dictionary(Of String, String)))
If IsNothing(rowdic) AndAlso rowdic.Count = 0 AndAlso (Not rowdic.ContainsKey("colounmdic")) Then
MsgBox($"数据加载失败!!数据为空或未检测到列信息。")
End If
Dim starttime As Long = 0
Dim stoptime As Long = 0
Dim kkdic As Dictionary(Of String Dictionary(Of Long, Double)) = New Dictionary(Of String, Dictionary(Of Long, Double))
Dim colounmdic As Dictionary(Of String, String) = rowdic.Item("colounmdic")
With Grid_Mysqldate
.NewFile()
.AutoRedraw = False
.Cols = colounmdic.Count + 3
.Rows = 1
.DisplayRowNumber = True
.Cell(0, 0).Text = "序号"
.Cell(0, 1).Text = "时间"
.Cell(0, 2).Text = "时间戳"
.Column(0).Width = 20
.Column(1).Width = 150
.Column(1).Alignment = AlignmentEnum.CenterCenter
For i = 0 To colounmdic.Count - 1
.Cell(0, i + 3).Text = colounmdic.Keys(i)
.Column(i + 3).Alignment = AlignmentEnum.CenterCenter
Next
Dim dtOffset As New DateTimeOffset(New DateTime(1970, 1, 1), TimeSpan.Zero)
' 获取本地日期和时间
For Each node In rowdic
If node.Key.Equals("colounmdic") Then Continue For
.AddItem("")
Dim t As Long = Long.Parse(node.Key)
t = t / 1000
Dim yt As DateTime = dtOffset + TimeSpan.FromSeconds(t)).LocalDateTime
If starttime = 0 OrElse t < starttime Then
starttime = t
End If
If stoptime = 0 OrElse t > stoptime Then
stoptime = t
End If
.Cell(.Rows - 1, 1).Text = yt.ToString("yyyy-MM-dd HH:mm:ss")
.Cell(.Rows - 1, 2).Text = t.ToString
For Each index In node.Value
For j = 0 To colounmdic.Count - 1
' 'Console.WriteLine(.Cell(0, j + 2).Text)
If .Cell(0, j + 3).Text.Equals(index.Key) Then
.Cell(.Rows - 1, j + 3).Text = index.Value
End If
Next
Next
Dim datadic As Dictionary(Of Long, Double)
If kkdic.ContainsKey(node.Value.Keys(0)) Then
datadic = kkdic.Item(node.Value.Keys(0))
If datadic.ContainsKey(t) Then
datadic.Item(t) = CInt(node.Value.Values(0))
Else
datadic.Add(t, node.Value.Values(0))
End If
Else
datadic = New Dictionary(Of Long, Double)
datadic.Add(t, node.Value.Values(0))
kkdic.Add(node.Value.Keys(0), datadic)
End If
Next
End With
Grid_Mysqldate.AutoRedraw = True
Grid_Mysqldate.Refresh()
InitPieChart(kkdic, starttime, stoptime)
End Sub
''' <summary>
''' 初始化Chart控件
''' </summary>
Private Sub InitTeeChart(kkdic As Dictionary(Of String Dictionary(Of Long, Double)), starttime As Long stoptime As Long)
ChartBar.AutoRepaint = False
ChartBar.Header.Lines = New String() {""} 'TeeChart标题
ChartBar.Panning.InsideBounds = True
ChartBar.Panning.Allow = ScrollModes.Horizontal
InitCustomAxies(kkdic, starttime, stoptime)
InitFastLine(kkdic)
InitCursor()
ChartBar.AutoRepaint = True
ChartBar.Refresh()
End Sub
Private Sub InitTeeChart(kkdic As Dictionary(Of String Dictionary(Of String, Double)), starttime As Date stoptime As Date)
ChartBar.AutoRepaint = False
ChartBar.Header.Lines = New String() {""} 'TeeChart标题
ChartBar.Panning.InsideBounds = True
ChartBar.Panning.Allow = ScrollModes.Horizontal
InitCustomAxies(kkdic, starttime, stoptime)
InitFastLine(kkdic)
InitCursor()
ChartBar.AutoRepaint = True
ChartBar.Refresh()
End Sub
''' <summary>
''' 初始化轴
''' </summary>
Private Sub InitCustomAxies(kkdic As Dictionary(Of String Dictionary(Of String, Double)), starttime As Date stoptime As Date)
_axis.Clear()
ChartBar.Axes.Custom.Clear()
ChartBar.Walls.Visible = False '不显示立面(背景色将统一)
ChartBar.Axes.Bottom.Title.Caption = "时间轴"
ChartBar.Axes.Bottom.Title.Visible = False
ChartBar.Axes.Bottom.MaximumOffset = 4 '最大值偏移
ChartBar.Axes.Bottom.MinimumOffset = 4 '最小值偏移
ChartBar.Axes.Bottom.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash
ChartBar.Axes.Bottom.Grid.Width = 2
ChartBar.Axes.Bottom.Ticks.Color = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
ChartBar.Axes.Bottom.Ticks.Length = 4 '标记长度
ChartBar.Axes.Bottom.Ticks.Width = 4 '标记宽度
ChartBar.Axes.Bottom.Grid.Transparency = 60
' _axis.Add(ChartBar.Axes.Bottom)
ChartBar.Axes.Bottom.Automatic = False
Dim dtOffset As New DateTimeOffset(New DateTime(1970, 1, 1, 0, 0, 0))
' 获取本地日期和时间
Dim yt As DateTime
yt = stoptime ' dtOffset.AddSeconds(stoptime)).LocalDateTime
ChartBar.Axes.Bottom.Maximum = yt.ToOADate
Dim bvtOffset As New DateTimeOffset(New DateTime(1970, 1, 1, 0, 0, 0))
yt = starttime ' dtOffset.AddSeconds(starttime)).LocalDateTime
ChartBar.Axes.Bottom.Minimum = yt.ToOADate
' ChartBar.Axes.Bottom.Increment = 1
ChartBar.Axes.Bottom.Logarithmic = False
'ChartBar.Axes.Right.Title.Right = 20
ChartBar.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM-dd HH"
ChartBar.Axes.Left.Title.Caption = "电流-电压轴"
ChartBar.Axes.Left.Title.Visible = False
ChartBar.Axes.Left.MaximumOffset = 4 '最大值偏移
ChartBar.Axes.Left.MinimumOffset = 4 '最小值偏移
ChartBar.Axes.Left.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash
ChartBar.Axes.Left.Grid.Width = 2
ChartBar.Axes.Left.Ticks.Color = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
ChartBar.Axes.Left.Ticks.Length = 2 '标记长度
ChartBar.Axes.Left.Ticks.Width = 2 '标记宽度
ChartBar.Axes.Left.Grid.Transparency = 60
ChartBar.Axes.Left.Automatic = False
ChartBar.Axes.Left.Minimum = 0.001
ChartBar.Axes.Left.Maximum = 1000
ChartBar.Axes.Left.Logarithmic = True
For i = 0 To kkdic.Count - 1
'_axis.Add(ChartBar.Axes.Left)
'Case Else 'IO
Dim idx As Integer = i
_axis.Add(New Steema.TeeChart.Axis)
_axis(i).Title.Caption = kkdic.Keys(i) '标题文本
_axis(i).Title.Font.Brush.Color = Color.GhostWhite
_axis(i).Title.Angle = 0 '标题角度
_axis(i).AxisPen.Color = Color.FromArgb(255, idx * 12, 255 - idx * 10, idx * 6) '颜色
_axis(i).OtherSide = True '右边显示
_axis(i).StartPosition = idx * 8.0R
_axis(i).EndPosition = _axis(i).StartPosition + 4.0R
_axis(i).Automatic = False
_axis(i).Minimum = 0
_axis(i).Maximum = 1
_axis(i).Increment = 1.0R
_axis(i).Grid.Visible = False
_axis(i).Labels.Angle = 0 '角度
ChartBar.Axes.Custom.Add(_axis(i))
'End Select
Next
End Sub
Private Sub InitCustomAxies(kkdic As Dictionary(Of String Dictionary(Of Long, Double)), starttime As Long stoptime As Long)
_axis.Clear()
ChartBar.Axes.Custom.Clear()
ChartBar.Walls.Visible = False '不显示立面(背景色将统一)
ChartBar.Axes.Bottom.Title.Caption = "时间轴"
ChartBar.Axes.Bottom.Title.Visible = False
ChartBar.Axes.Bottom.MaximumOffset = 4 '最大值偏移
ChartBar.Axes.Bottom.MinimumOffset = 4 '最小值偏移
ChartBar.Axes.Bottom.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash
ChartBar.Axes.Bottom.Grid.Width = 2
ChartBar.Axes.Bottom.Ticks.Color = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
ChartBar.Axes.Bottom.Ticks.Length = 4 '标记长度
ChartBar.Axes.Bottom.Ticks.Width = 4 '标记宽度
ChartBar.Axes.Bottom.Grid.Transparency = 60
' _axis.Add(ChartBar.Axes.Bottom)
ChartBar.Axes.Bottom.Automatic = False
Dim dtOffset As New DateTimeOffset(New DateTime(1970, 1, 1, 0, 0, 0))
' 获取本地日期和时间
Dim yt As DateTime
yt = dtOffset.AddSeconds(stoptime)).LocalDateTime
ChartBar.Axes.Bottom.Maximum = yt.ToOADate
Dim bvtOffset As New DateTimeOffset(New DateTime(1970, 1, 1, 0, 0, 0))
yt = dtOffset.AddSeconds(starttime)).LocalDateTime
ChartBar.Axes.Bottom.Minimum = yt.ToOADate
' ChartBar.Axes.Bottom.Increment = 1
ChartBar.Axes.Bottom.Logarithmic = False
'ChartBar.Axes.Right.Title.Right = 20
ChartBar.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM-dd HH"
ChartBar.Axes.Left.Title.Caption = "电流-电压轴"
ChartBar.Axes.Left.Title.Visible = False
ChartBar.Axes.Left.MaximumOffset = 4 '最大值偏移
ChartBar.Axes.Left.MinimumOffset = 4 '最小值偏移
ChartBar.Axes.Left.Grid.Style = System.Drawing.Drawing2D.DashStyle.Dash
ChartBar.Axes.Left.Grid.Width = 2
ChartBar.Axes.Left.Ticks.Color = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
ChartBar.Axes.Left.Ticks.Length = 2 '标记长度
ChartBar.Axes.Left.Ticks.Width = 2 '标记宽度
ChartBar.Axes.Left.Grid.Transparency = 60
ChartBar.Axes.Left.Automatic = False
ChartBar.Axes.Left.Minimum = 0.001
ChartBar.Axes.Left.Maximum = 1000
ChartBar.Axes.Left.Logarithmic = True
For i = 0 To kkdic.Count - 1
'_axis.Add(ChartBar.Axes.Left)
'Case Else 'IO
Dim idx As Integer = i
_axis.Add(New Steema.TeeChart.Axis)
_axis(i).Title.Caption = kkdic.Keys(i) '标题文本
_axis(i).Title.Font.Brush.Color = Color.GhostWhite
_axis(i).Title.Angle = 0 '标题角度
_axis(i).AxisPen.Color = Color.FromArgb(255, idx * 12, 255 - idx * 10, idx * 6) '颜色
_axis(i).OtherSide = True '右边显示
_axis(i).StartPosition = idx * 8.0R
_axis(i).EndPosition = _axis(i).StartPosition + 4.0R
_axis(i).Automatic = False
_axis(i).Minimum = 0
_axis(i).Maximum = 1
_axis(i).Increment = 1.0R
_axis(i).Grid.Visible = False
_axis(i).Labels.Angle = 0 '角度
ChartBar.Axes.Custom.Add(_axis(i))
'End Select
Next
End Sub
''' <summary>
''' 初始化线
''' </summary>
Private Sub InitFastLine(kkdic As Dictionary(Of String Dictionary(Of Long, Double)))
ChartBar.Series.Clear()
_fastLine.Clear()
For i = 0 To kkdic.Count - 1
_fastLine.Addkkdic.Keys(i), New Steema.TeeChart.Styles.FastLine)
AddHandler _fastLine.Item(kkdic.Keys(i)).Click, AddressOf FastLine1_Click
' _fastLine(i).Title = $"电流{i}" ' FastLineTitle(i) '标题
_fastLine.Item(kkdic.Keys(i)).TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint
ChartBar.Series.Add(_fastLine.Item(kkdic.Keys(i)))
_fastLine.Item(kkdic.Keys(i)).XValues.DateTime = True
'Select Case i
' Case 0
' _fastLine(i).Title = $"电流"
' ' FastLine(i).CustomVertAxis = ChartBar.Axes.Left '绑定电流轴
' _fastLine(i).Transparency = 0 '线条透明度
' _fastLine(i).LinePen.Color = Color.FromArgb(255, 255, 0, 0) '线条颜色
'
' Case 1 To 5
' If i = 1 Then
' _fastLine(i).Title = $"电压"
' Else
' _fastLine(i).Title = $"CH{i - 1}"
' End If
' ' _fastLine(i).Visible = False
' ' _fastLine(i).CustomVertAxis = _axis(0) '绑定电压
' _fastLine(i).Transparency = 75 '线条透明度
' _fastLine(i).LinePen.Color = Color.FromArgb(126, 0, 0, 255) '线条颜色
' _fastLine(i).Legend.Visible = True '不在图例中显示
' Case Else
_fastLine.Item(kkdic.Keys(i)).Title = $"{kkdic.Keys(i)}"
'_fastLine(i).Legend.Visible = True '不在图例中显示
' _fastLine.Item(kkdic.Keys(i)).Visible = False
_fastLine.Item(kkdic.Keys(i)).Transparency = 0 '线条透明度
_fastLine.Item(kkdic.Keys(i)).CustomVertAxis = _axis(i) '绑定IO轴
_fastLine.Item(kkdic.Keys(i)).Stairs = True '线条阶梯状
Dim random As New Random()
_fastLine.Item(kkdic.Keys(i)).LinePen.Color = Color.GhostWhite '线条颜色
'_fastLine.Item(kkdic.Keys(i)).LinePen.Color = Color.Blue
_fastLine.Item(kkdic.Keys(i)).LinePen.Width = 2
_fastLine.Item(kkdic.Keys(i)).Legend.Visible = False '不在图例中显示
' _fastLine(i).LinePen.Color = _axis(i - 5).Labels.Color
'End Select
' FastLine(i).LinePen.Color = Color.FromArgb(12, 12, 12, 12) '颜色
' FastLine(i).ColorEach = False '各点之间颜色不一
Next
End Sub
Private Sub InitFastLine(kkdic As Dictionary(Of String Dictionary(Of String, Double)))
ChartBar.Series.Clear()
_fastLine.Clear()
For i = 0 To kkdic.Count - 1
_fastLine.Addkkdic.Keys(i), New Steema.TeeChart.Styles.FastLine)
AddHandler _fastLine.Item(kkdic.Keys(i)).Click, AddressOf FastLine1_Click
' _fastLine(i).Title = $"电流{i}" ' FastLineTitle(i) '标题
_fastLine.Item(kkdic.Keys(i)).TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint
ChartBar.Series.Add(_fastLine.Item(kkdic.Keys(i)))
_fastLine.Item(kkdic.Keys(i)).XValues.DateTime = True
'Select Case i
' Case 0
' _fastLine(i).Title = $"电流"
' ' FastLine(i).CustomVertAxis = ChartBar.Axes.Left '绑定电流轴
' _fastLine(i).Transparency = 0 '线条透明度
' _fastLine(i).LinePen.Color = Color.FromArgb(255, 255, 0, 0) '线条颜色
'
' Case 1 To 5
' If i = 1 Then
' _fastLine(i).Title = $"电压"
' Else
' _fastLine(i).Title = $"CH{i - 1}"
' End If
' ' _fastLine(i).Visible = False
' ' _fastLine(i).CustomVertAxis = _axis(0) '绑定电压
' _fastLine(i).Transparency = 75 '线条透明度
' _fastLine(i).LinePen.Color = Color.FromArgb(126, 0, 0, 255) '线条颜色
' _fastLine(i).Legend.Visible = True '不在图例中显示
' Case Else
_fastLine.Item(kkdic.Keys(i)).Title = $"{kkdic.Keys(i)}"
'_fastLine(i).Legend.Visible = True '不在图例中显示
' _fastLine.Item(kkdic.Keys(i)).Visible = False
_fastLine.Item(kkdic.Keys(i)).Transparency = 0 '线条透明度
_fastLine.Item(kkdic.Keys(i)).CustomVertAxis = _axis(i) '绑定IO轴
_fastLine.Item(kkdic.Keys(i)).Stairs = True '线条阶梯状
Dim random As New Random()
_fastLine.Item(kkdic.Keys(i)).LinePen.Color = Color.GhostWhite '线条颜色
'_fastLine.Item(kkdic.Keys(i)).LinePen.Color = Color.Blue
_fastLine.Item(kkdic.Keys(i)).LinePen.Width = 2
_fastLine.Item(kkdic.Keys(i)).Legend.Visible = False '不在图例中显示
' _fastLine(i).LinePen.Color = _axis(i - 5).Labels.Color
'End Select
' FastLine(i).LinePen.Color = Color.FromArgb(12, 12, 12, 12) '颜色
' FastLine(i).ColorEach = False '各点之间颜色不一
Next
End Sub
Private Sub InitCursor()
ChartBar.Tools.Clear()
For i = 0 To _curSor.Length - 1
_curSor(i) = New Steema.TeeChart.Tools.CursorTool
ChartBar.Tools.Add(_curSor(i))
_curSor(i).Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical
_curSor(i).OriginalCursor = System.Windows.Forms.Cursors.Default
_curSor(i).Pen.Style = System.Drawing.Drawing2D.DashStyle.Dot
_curSor(i).Pen.Width = 2
_curSor(i).Tag = i
_curSor(i).Active = True
_curSor(i).FollowMouse = False
AddHandler _curSor(i).Change, AddressOf CursorChange
Select Case i
Case 0
_curSor(i).Pen.Color = System.Drawing.Color.Orange
Case 1
_curSor(i).Pen.Color = System.Drawing.Color.Lime
Case 2
_curSor(i).Pen.Color = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer))
End Select
Next
End Sub
''' <summary>
''' 光标位置改变触发事件
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub CursorChange(sender As Object, e As Steema.TeeChart.Tools.CursorChangeEventArgs)
Dim index As Integer = sender.tag
CursorChangeDataDisplay(index)
End Sub
''' <summary>
''' 光标移动显示数据
''' </summary>
''' <param name="index">当前移动的是第几个光标</param>
Private Sub CursorChangeDataDisplay(index As Integer)
Dim X1 As Double = 0
Dim X2 As Double = 0
Dim dtOffset As New DateTimeOffset(New DateTime(1900, 1, 1), TimeSpan.Zero)
' 获取本地日期和时间
Dim yt As DateTime
Dim ts As TimeSpan
Select Case index
Case 0
X1 = _curSor(index).XValue.ToString("#0.0000")
'yt.too
yt = DateTime.FromOADate(X1)
'Console.WriteLine($"CursorChangeDataDisplay:X1 {X1}:{yt.ToString("yyyy-MM-dd HH:mm:ss")}")
'yt = dtOffset + TimeSpan.FromDays(X1)).LocalDateTime
'yt = yt + TimeSpan.FromHours(8)
labY1.Text = yt.ToString("dd HH:mm:ss")
ts = New TimeSpan(yt.Ticks)
labY1.Tag = ts.TotalSeconds
Case 1
X2 = _curSor(index).XValue.ToString("#0.0000")
yt = DateTime.FromOADate(X2)
'yt = yt + TimeSpan.FromHours(8)
labY2.Text = yt.ToString("dd HH:mm:ss")
'Console.WriteLine($"CursorChangeDataDisplay:X2 {X2}:{yt.ToString("yyyy-MM-dd HH:mm:ss")}")
ts = New TimeSpan(yt.Ticks)
labY2.Tag = ts.TotalSeconds
End Select
Double.TryParse(labY1.Tag, X1)
Double.TryParse(labY2.Tag, X2)
Dim couinm As Double = X2 - X1
lab1_2.Text = ""
If couinm < 0 Then
lab1_2.Text = " - "
End If
';'Console.WriteLine($"CursorChangeDataDisplay:{ _curSor(index).XValue.ToString("#0.00")}|{_curSor(index).XValue.ToString("#0.00")}|{couinm}")
Dim timeval As TimeSpan = TimeSpan.FromSeconds(Math.Abs(couinm))
' 'Console.WriteLine(couinm)
If timeval.Days > 0 Then
lab1_2.Text = $"{ lab1_2.Text}{timeval.Days }天 "
End If
lab1_2.Text = $"{ lab1_2.Text}{timeval.Hours }:{timeval.Minutes }:{timeval.Seconds }"
End Sub
Private _curTool As Steema.TeeChart.Tools.CursorTool
Private Sub ChartBar_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles ChartBar.MouseDoubleClick
If e.Button = MouseButtons.Middle Then
ChartBar.Zoom.Undo()
ElseIf e.Button = MouseButtons.Left Then
Dim idx As Integer
Dim row As Integer
If _curTool Is Nothing Then
idx = 0
_curTool = _curSor(idx)
_curTool.FollowMouse = True
'row = _rowChart.Cursor + idx * (EnCursor.Width + 2) + 1 + EnCursor.FollowMouse + 1
'GrdChartInfo.Cell(row, EnGridCol.Value).Text = $"1"
Else
If _curTool.FollowMouse = False Then
idx = _curTool.Tag
' row = _rowChart.Cursor + idx * (EnCursor.Width + 2) + 1 + EnCursor.FollowMouse + 1
'_isUserChange = False
_curTool.FollowMouse = False
'GrdChartInfo.Cell(row, EnGridCol.Value).Text = $"0"
idx += 1
If idx >= _curSor.Length Then
idx = 0
_curTool = _curSor(idx)
_curTool.FollowMouse = True
Else
_curTool = _curSor(idx)
_curTool.FollowMouse = True
' row = _rowChart.Cursor + idx * (EnCursor.Width + 2) + 1 + EnCursor.FollowMouse + 1
'GrdChartInfo.Cell(row, EnGridCol.Value).Text = $"1"
End If
'_isUserChange = True
End If
End If
End If
End Sub
Private Sub ChartBar_MouseClick(sender As Object, e As MouseEventArgs) Handles ChartBar.MouseClick
If e.Button = MouseButtons.Middle Then
ChartBar.Zoom.Undo()
ElseIf e.Button = MouseButtons.Right Then
If IsNothing(_curTool) Then Return
_curTool.FollowMouse = False
End If
End Sub
Private Sub FastLine1_Click(sender As Object, e As MouseEventArgs)
Dim fl As Styles.FastLine = sender
'For Each node In _fastLine
' If node.Value.Title.Equals(fl.Title) Then
' fl = node.Value
' Dim x1 As Double = 0
' labdevanme.Text = fl.Title
' ''Console.WriteLine($"{e.X} {fl.YValues.Value(e.X).ToString("#0.0.")} {e.Y} {fl.YValues.Value(e.Y).ToString("#0.00")}")
' Dim intcv As Integer = CIntMath.Round(ChartBar.Series(0).YScreenToValue(e.Y))
' labval.Text = intcv.ToString
' 'Console.WriteLine(fl.XValues.Value.Length)
' x1 = ChartBar.Series(0).XScreenToValue(e.X)
' Dim stra As String = fl.XValues.AsDateTime(e.X)
' Dim dtOffset As New DateTimeOffset(New DateTime(1970, 1, 1), TimeSpan.Zero)
' ' 获取本地日期和时间
' Dim yt As DateTime
' yt = DateTime.FromOADate(x1)
' yt = yt + TimeSpan.FromHours(8)
' 'Console.WriteLine($"FastLine1_Click:{x1}:{ yt.ToString("yyyy-MM-dd HH:mm:ss")}")
' labDate.Text = yt.ToString("yyyy-MM-dd HH:mm:ss")
' End If
'Next
End Sub
Private Sub Grid_config_ComboDropDown(Sender As Object, e As Grid.ComboDropDownEventArgs) Handles Grid_config.ComboDropDown
Grid_config.ComboBox(0).Items.Clear()
If IsNothing(devnamedic) OrElse devnamedic.Count = 0 Then Return
Grid_config.ComboBox(0).Items.AddRange(devnamedic.ToArray)
End Sub
End Class