請教大神為何如下VB6.0的TEECHART編譯錯誤:可在TEECAHRT5.0運行,但在TEECHART8.0下無法運行。
Option Base 1
Option Explicit
Dim TheClickedPyramid As Integer
Private Sub Command4_Click()
Dim Contents As String, Msg As String, a
Dim filenum As Integer, X, temp, filename
Dim q() As Double
filenum = FreeFile
On Error GoTo SaveFileError
Me.CommonDialog1.ShowOpen
filename = CommonDialog1.filename
If Trim(filename) = "" Then Exit Sub
Open filename For Input As filenum
Input #filenum, temp
MSFlexGrid1.Rows = temp + 1
ReDim q(temp)
For X = 1 To MSFlexGrid1.Rows - 1
Input #filenum, temp, a
q(temp) = a
MSFlexGrid1.TextMatrix(X, 0) = temp
MSFlexGrid1.TextMatrix(X, 1) = a
Next X
Close filenum
'gengxintu
drew q
' On Error GoTo 0
' MSFlexGrid1.HighLight = 1 'True
Exit Sub
SaveFileError:
Msg$ = "選定的資料檔案中的資料存放格式不正確,請檢查!" & Chr(13) & "正確的格式:" & Chr(13) & _
"首行為時段數,以下各行每行兩個數,第一個為時標或序號,第二個為流量值。"
MsgBox Msg, 48
Close
Screen.MousePointer = 0
Exit Sub
End Sub
Sub form_load()
MSFlexGrid1.TextMatrix(0, 0) = "時序"
MSFlexGrid1.TextMatrix(0, 1) = "流量"
End Sub
Sub drew(q() As Double)
Dim row As Integer, axisID As Integer, aa
Dim i As Integer
With TChart1
.Series(0).Clear
For i = 1 To UBound(q)
.Series(0).Add q(i), i, clTeeColor
Next i
End With
' change pyramids cursor...
TChart1.Series(0).Cursor = 2020
' do not allow zoom and scroll
TChart1.Zoom.Enable = False
TChart1.Scroll.Enable = pmNone
' set temporary variables...
TheClickedPyramid = -1
TheOriginalValue = 0
' Me.MSChart1.TitleText = Me.Caption ' "程序線"
End Sub
Private Sub TChart1_OnAfterDraw()
' Custom draw a white circle around the clicked pyramid...
Dim X, Y As Integer
If TheClickedPyramid <> -1 Then
With TChart1.Canvas
.Pen.Color = vbWhite
.Pen.Width = 1
.Pen.Style = psDot
.Brush.Style = bsClear
End With
With TChart1.Series(0)
X = .CalcXPosValue(TheClickedPyramid)
Y = .CalcYPosValue(TheClickedPyramid)
TChart1.Canvas.Ellipse X, Y, X + 40, Y + 40
End With
End If
End Sub
Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
' calculate if mouse has clicked a Pyramid...
TheClickedPyramid = TChart1.Series(0).Clicked(X, Y)
End Sub
Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
' drag the pyramid !!!
If TheClickedPyramid <> -1 Then
With TChart1.Series(0)
.PointValue(TheClickedPyramid) = .YScreenToValue(Y)
End With
End If
End Sub
Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
' when releasing mouse, stop dragging...
TheClickedPyramid = -1
TChart1.Repaint
End Sub
提示 紅色部分出現錯誤
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/116746.html
標籤:控件
