⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmindicators.frm

📁 枕善居汉化的stockchart股软 描 述:实时股票图表曲线示例 Ver 1.0 网 站:http://www.mndsoft.com/ e-mail :mndsoft@163.com 最新的
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Call UpdateChart
        End If
        Call LoadCurrentSettings(sIndicators$)
        cmdChangeInd.Caption = "C&hange"
        bSelectingInd = False
    End If
End Sub
Private Sub DirtyFlagRoutine()
    Dim iResult As Long
     'if last indicator was edited then reset if wanted
    If bDirtyFlag Then iResult = MsgBox("Editting for the last Indicator has not been saved..." & _
            vbCrLf & "Do you want to save the changes?", vbQuestion + vbYesNo + vbDefaultButton2, _
            "Changes Not Saved")
    If iResult = vbNo Then Call ResetValues
    bDirtyFlag = False
End Sub
Private Sub cmdChangeInd_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Not bSelectingInd Then
        cmdChangeInd.ToolTipText = sEmpty
    Else
        If x < cmdChangeInd.Width / 2 Then  'OK side
            fButtonRightSide = False
            cmdChangeInd.ToolTipText = "OK to Save"
        Else    'Esc side
            fButtonRightSide = True
            cmdChangeInd.ToolTipText = "Cancel Change"
        End If
    End If
End Sub

Private Sub cmdSave_Click()
    Unload Me
End Sub

Private Sub cmdUndo_Click()
    oLastEditItem.SubItems(1) = oLastEditItem.Tag
    Call WriteIni(sINIsetFile$, sSection$, oLastEditItem.Text, oLastEditItem.Tag)
    Call UpdateChart
    cmdUndo.Enabled = False
End Sub

Private Sub Form_Load()
    sOrgInd$ = CurrentIndicator$
    sFrameCaption$ = Frame1.Caption & " -> "
    Call LoadCurrentSettings(sIndicators$)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call SaveIndicatorSettings
    Set frmIndicators = Nothing
End Sub

Private Sub LoadCurrentSettings(sType As String)
    Dim i As Integer, sKey As String, iNumSettings As Long
    Dim sValue As String, iPicCount As Long, iRowCount As Long
    
    lstVwSettings.ListItems.Clear
    lstVwSettings.ToolTipText = "Dbl Click to Edit"
    On Error Resume Next  'if the header is already added proceed anyway
    lstVwSettings.ColumnHeaders.add (2), "Value", "Value", 1700, vbRightJustify
    On Error GoTo 0

    Select Case sType
        Case sIndicators$
            Frame1.Caption = sFrameCaption$ & CurrentIndicator$
            lstVwSettings.ColumnHeaders(1).Text = sParameters$
            sSection$ = CurrentIndicator$ & "Settings"
            iNumSettings = GetNumIniKeys(sINIsetFile$, sSection$)
        Case sAverages$
            Frame1.Caption = sFrameCaption$ & sAverages$
            lstVwSettings.ColumnHeaders(1).Text = sParameters$
            sSection$ = "AvgSettings"
            iNumSettings = GetNumIniKeys(sINIsetFile$, sSection$)
    End Select
    
    If iNumSettings <> 0 Then
        For i = 1 To iNumSettings
            iRowCount = iRowCount + 1
            sKey$ = GetIniKey(sINIsetFile$, sSection$, CStr(i))
            sValue$ = GetIni(sINIsetFile$, sSection$, sKey$)
            lstVwSettings.ListItems.add iRowCount, sKey$, sKey$
            lstVwSettings.ListItems(sKey$).SubItems(1) = sValue$
            'save the original value(for cancelling)
            lstVwSettings.ListItems(sKey$).Tag = sValue$
            If InStr(UCase(sKey$), "COLOR") <> 0 Then 'color setting, add picBx
                If iPicCount <> 0 Then
                    Load picColor(iPicCount)
                End If
                picColor(iPicCount).Move lstVwSettings.Left + 20 + Frame1.Left + lstVwSettings.ListItems(iRowCount).Left + lstVwSettings.ColumnHeaders(1).Width, _
                    lstVwSettings.Top + 60 + Frame1.Top + lstVwSettings.ListItems(iRowCount).Top, _
                    lstVwSettings.ColumnHeaders(2).Width, lstVwSettings.ListItems(iRowCount).Height
                picColor(iPicCount).ZOrder 0
                picColor(iPicCount).BackColor = CLng(sValue$)
                'save key in tag so we know item when pic is dblclked
                picColor(iPicCount).Tag = sKey$
                picColor(iPicCount).Visible = True
                'modify the item tag so we know which picBx index goes with the item
                lstVwSettings.ListItems(sKey$).Tag = lstVwSettings.ListItems(sKey$).Tag _
                                                    & "|" & iPicCount
                iPicCount = iPicCount + 1
            End If
            
            If sType = sAverages$ And i Mod 3 = 0 Then
                iRowCount = iRowCount + 1  'adding a blank line between averages
                lstVwSettings.ListItems.add iRowCount, "blank" & iRowCount, sEmpty
                lstVwSettings.ListItems("blank" & iRowCount).ToolTipText = sEmpty
            End If
        Next
    End If
End Sub
Private Sub lstVwSettings_DblClick()
    If Not bSelectingInd Then
        'if we dblClked then do the edit on current item
        If InStr(UCase(oClickedItem), "COLOR") <> 0 Then 'call color selector
            Dim p As Long
            oClickedItem.SubItems(1) = GetColorDlg(oClickedItem.SubItems(1))
            'fish out the picBx index from the item tag
            p = InStr(oClickedItem.Tag, "|")
            picColor(Mid$(oClickedItem.Tag, p + 1)).BackColor = oClickedItem.SubItems(1)
            Call UpdateColor(oClickedItem)
        ElseIf oClickedItem <> sEmpty Then
            bBooleanEdit = False
            txtEdit.Move lstVwSettings.Left + 4 + Frame1.Left + oClickedItem.Left + lstVwSettings.ColumnHeaders(1).Width, _
                        lstVwSettings.Top + 10 + Frame1.Top + oClickedItem.Top, _
                        lstVwSettings.ColumnHeaders(2).Width, oClickedItem.Height - 10
            
            If UCase(oClickedItem.SubItems(1)) = "TRUE" Or UCase(oClickedItem.SubItems(1)) = "FALSE" Then
                bBooleanEdit = True
            End If
            txtEdit.Text = oClickedItem.SubItems(1)
            txtEdit.Visible = True
            txtEdit.SetFocus
        End If
    Else
        CurrentIndicator$ = oClickedItem.Text
        Frame1.Caption = sFrameCaption$ & CurrentIndicator$
        Call WriteIni(sINIsetFile$, "Settings", "CurrentIndicator", CurrentIndicator$)
        Call UpdateChart
    End If
    
End Sub

Private Sub lstVwSettings_ItemClick(ByVal Item As MSComctlLib.ListItem)
    'save item here since we don't have an "ItemDblClick" event
    Set oClickedItem = Item
End Sub

Private Sub lstVwSettings_KeyPress(KeyAscii As Integer)
'Debug.Print KeyAscii
    Select Case KeyAscii
        Case 13 'enter
            If bSelectingInd Then  'make change happen
                CurrentIndicator$ = lstVwSettings.SelectedItem.Text
                fButtonRightSide = False 'OK button side
                Call cmdChangeInd_Click
            End If
    End Select
End Sub

Private Sub lstVwSettings_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    If Button = 1 Then
        txtEdit.Visible = False
    ElseIf Button = 2 Then
        
    End If
End Sub

Private Sub lstVwSettings_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
    'needed... listvw was taking the focus away from the editbox
    If Not bSelectingInd And txtEdit.Visible = True Then txtEdit.SetFocus
End Sub

Private Sub UpdateColor(ByVal Item As MSComctlLib.ListItem)
    Set oLastEditItem = Item
    bDirtyFlag = True 'set edited flag
    cmdUndo.Enabled = True
    'save the new value and redraw chart for dynamic real-time updating
    Call WriteIni(sINIsetFile$, sSection$, Item.Text, Item.SubItems(1))
    Call UpdateChart
End Sub
Private Sub picColor_DblClick(Index As Integer)
    picColor(Index).BackColor = GetColorDlg(picColor(Index).BackColor)
    'key of the item was stored in the pic tag
    lstVwSettings.ListItems(picColor(Index).Tag).SubItems(1) = picColor(Index).BackColor
    Call UpdateColor(lstVwSettings.ListItems(picColor(Index).Tag))
End Sub

Private Sub txtEdit_Change()
    If bBooleanEdit Then
        'filter the edit text for boolean values only
        Select Case UCase(Left$(txtEdit.Text, 1))
            Case "T", "1", "-1"
                txtEdit.Text = "True"
            Case "F", "0"
                txtEdit.Text = "False"
            Case Else
                txtEdit.Text = sEmpty
        End Select
    Else
        'just want numeric values
        If Not IsNumeric(txtEdit.Text) Then txtEdit.Text = sEmpty
    End If
End Sub

Private Sub txtEdit_GotFocus()
    txtEdit.SelStart = 0
    txtEdit.SelLength = Len(txtEdit.Text)
End Sub

Private Sub txtEdit_KeyDown(KeyCode As Integer, Shift As Integer)
'Debug.Print KeyCode
    Select Case KeyCode
        Case vbKeyEscape
            txtEdit.Text = sEmpty
            txtEdit.Visible = False
        Case vbKeyReturn
            oClickedItem.SubItems(1) = txtEdit.Text
            bDirtyFlag = True 'set edited flag
            cmdUndo.Enabled = True
            Set oLastEditItem = oClickedItem
            'save the new value and redraw chart for dynamic real-time updating
            Call WriteIni(sINIsetFile$, sSection$, oClickedItem.Text, oClickedItem.SubItems(1))
            Call UpdateChart
            txtEdit.Visible = False
        Case Else
            'do nothing
    End Select
End Sub

Private Sub tmrAfterLoad_Timer()
    tmrAfterLoad.Enabled = False
    Call PositionMousePointer(cmdcancel.hWnd, cmdcancel.Width \ 2, cmdcancel.Height / 1.2, False)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -