📄 mouse.frm
字号:
VERSION 5.00
Object = "{8996B0A4-D7BE-101B-8650-00AA003A5593}#4.0#0"; "CFX4032.OCX"
Begin VB.Form Form1
Caption = "Chart FX. Handling Mouse Events"
ClientHeight = 6195
ClientLeft = 2625
ClientTop = 990
ClientWidth = 7500
LinkTopic = "Form1"
ScaleHeight = 6195
ScaleWidth = 7500
Begin ChartfxLibCtl.ChartFX ChartFX1
Height = 4935
Left = 240
TabIndex = 10
Top = 120
Width = 7095
_cx = 2011042776
_cy = 2011042776
Build = 7
TypeMask = 42598657
Style = -8388610
MarkerShape = 2
MarkerSize = 6
Axis(0).MinorStep= -10
Axis(2).MinorStep= -1
nPts = 6
NumPoint = 6
End
Begin VB.TextBox Text5
Height = 315
Left = 5280
TabIndex = 8
Top = 5280
Width = 2055
End
Begin VB.TextBox Text4
Height = 315
Left = 2880
TabIndex = 6
Top = 5760
Width = 1215
End
Begin VB.TextBox Text3
Height = 315
Left = 2880
TabIndex = 4
Top = 5280
Width = 1215
End
Begin VB.TextBox Text2
Height = 315
Left = 720
TabIndex = 2
Top = 5760
Width = 1215
End
Begin VB.TextBox Text1
Height = 315
Left = 720
TabIndex = 0
Top = 5280
Width = 1215
End
Begin VB.Label Label5
Caption = "Hit Element"
Height = 255
Left = 4320
TabIndex = 9
Top = 5280
Width = 855
End
Begin VB.Label Label4
Caption = "Point:"
Height = 255
Left = 2160
TabIndex = 7
Top = 5760
Width = 615
End
Begin VB.Label Label3
Caption = "Series:"
Height = 255
Left = 2160
TabIndex = 5
Top = 5280
Width = 615
End
Begin VB.Label Label2
Caption = "Y:"
Height = 255
Left = 360
TabIndex = 3
Top = 5760
Width = 255
End
Begin VB.Label Label1
Caption = "X:"
Height = 255
Left = 360
TabIndex = 1
Top = 5280
Width = 255
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim sHitName(13)
Private Sub ChartFX1_MouseMoving(ByVal x As Integer, ByVal y As Integer, nRes As Integer)
Dim nHit As CfxHitTest
Dim nSeries As Integer
Dim nPoint As Long
Dim dX As Double
Dim dy As Double
' Convert from pixel to logical X,Y coordinates
ChartFX1.PixelToValue x, y, dX, dy, AXIS_Y
Text1.Text = Format(dX, "0.0")
Text2.Text = Format(dy, "#")
' Find out what was hit
nHit = ChartFX1.HitTest(x, y, nSeries, nPoint)
Text3.Text = nSeries + 1
Text4.Text = nPoint + 1
Text5.Text = sHitName(nHit)
End Sub
Private Sub Form_Load()
' Enable MouseMoving Event
ChartFX1.TypeMask = ChartFX1.TypeMask Or CT_TRACKMOUSE
sHitName(0) = "Background"
sHitName(1) = "2D Background Area"
sHitName(2) = "3D Background Area"
sHitName(3) = "Value (middle)"
sHitName(4) = "Point Marker"
sHitName(5) = "Y Axis"
sHitName(6) = "Secondary Y-Axis"
sHitName(7) = "X-Axis"
sHitName(8) = "Secondary X Axis"
sHitName(9) = "Left Title"
sHitName(10) = "Rigth Title"
sHitName(11) = "Top Title"
sHitName(12) = "Bottom Title"
' Show Secondary Y-Axis
ChartFX1.Axis(AXIS_Y2).Min = 0
ChartFX1.Axis(AXIS_Y2).Max = 300
ChartFX1.Axis(AXIS_Y2).Visible = True
' Show Titles
ChartFX1.Title(CHART_LEFTTIT) = "What's this ?"
ChartFX1.Title(CHART_TOPTIT) = "What's this ?"
ChartFX1.Title(CHART_RIGHTTIT) = "What's this ?"
ChartFX1.Title(CHART_BOTTOMTIT) = "What's this ?"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -