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

📄 cwinxpcengine.cls

📁 进销存管理系统
💻 CLS
📖 第 1 页 / 共 4 页
字号:
     NewTabXP.DrawTabStrip
     
   
   Set NewTabXP = Nothing
   
   ReleaseDC m_hWnd, hdc

End Sub

Private Sub DrawCombo()
Dim NewComboXP As cComboBoxXP
Dim hdc As Long

hdc = GetDC(m_hWnd)
 
    Set NewComboXP = New cComboBoxXP
        NewComboXP.hdc = hdc
        NewComboXP.hwnd = m_hWnd
        NewComboXP.State = IIf(IsWindowEnabled(m_hWnd) = 0, C_Disabled, ButtonState)
        NewComboXP.ColorScheme = m_SchemeColor
        NewComboXP.DrawComboBox
    Set NewComboXP = Nothing

    ReleaseDC m_hWnd, hdc

End Sub


Private Function DroppedDown() As Boolean
  DroppedDown = (SendMessageLong(m_hWnd, CB_GETDROPPEDSTATE, 0, 0) <> 0)
End Function

Private Sub Class_Terminate()
   pRelease
   If hHook Then UnhookWindowsHookEx hHook
End Sub

Public Sub UnloadEngine()
        Class_Terminate
End Sub
Private Property Let ISubclass_MsgResponse(ByVal RHS As EMsgResponse)
   ' intentionally blank
End Property

Private Property Get ISubclass_MsgResponse() As EMsgResponse
   
   If (CurrentMessage = WM_PAINT) Then
      ISubclass_MsgResponse = emrPreprocess
   Else
      ISubclass_MsgResponse = emrPostProcess
   End If
   
End Property

Private Function ISubclass_WindowProc(ByVal hwnd As Long, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
          
       
     'm_CBug = IIf(ButtonState = C_Down, True, False)

  
          
'======================================================================================
     'Line Below Paints the ProgressBar a lot of times ...when ever
     'the progress fires a message in WindowProc..
     'This eliminates the Flicker on the control  + - 50% ;)
     If m_ProgressBar Then DrawControlClass
         
          
          
          
'=============================================================================================
'                                       SUBCLASS MESSAGES
                                        
 Select Case iMsg   '//--- SELECT THE SUBCLASSED WINDOW MESSAGE.... CLEAR ENOUGH?
   

'==========================================================================================
'==========================================================================================
'The WM_COMMAND message is sent when the user selects a command item from a menu, when a control
'sends a notification message to its parent window, or when an accelerator keystroke is translated.

   
   Case WM_COMMAND
      
     'The CBN_CLOSEUP notification message is sent
     'when the list box of a combo box has been closed.
     'The parent window of the combo box receives this
     'notification message through the WM_COMMAND message
      
      
    
      If (m_hWnd = lParam) Then ' lParam handle to Control (combo box)
        
         Select Case wParam \ &H10000  'WParam identifier of control (combo box)
         
            Case CBN_CLOSEUP
                 ButtonState = C_Normal
                 MovementFlag = C_Disabled
                 bOver = False
                 DrawControlClass
                 KillTimer m_hWnd, 1
            Case Else
                 'Nothing
             
         End Select
            
           
      End If
    
 '==========================================================================================
'==========================================================================================
'The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in
'the specified device context.
 
 Case WM_PRINTCLIENT
      
      PrintTabClientColor

'==========================================================================================
'==========================================================================================
'The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box,
'list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.<-Tabstrip in this case
   
   
   Case WM_DRAWITEM
      
      Dim tDis As DRAWITEMSTRUCT
      
      If wParam = 0 Then
         CopyMemory tDis, ByVal lParam, Len(tDis)
         If tDis.CtlType = ODT_TAB And tDis.hWndItem = m_hWnd Then   '//--Check For StripTab
            m_TSILNumber = m_TSINumber
            m_TSINumber = tDis.itemID
            DrawControlClass
         End If
      End If
 
  
'==========================================================================================
'==========================================================================================
'The WM_ACTIVATE message is sent to both the window being activated and the window being
'deactivated.If the windows use the same input queue, the message is sent synchronously,
'first to the window procedure of the top-level window being deactivated, then to the window
'procedure of the top-level window being activated. If the windows use different input queues,
'the message is sent asynchronously, so the window is activated immediately.

                     
   Case WM_ACTIVATE
                
                             
              If m_MsgBox And InStr(ThisWindowClassName(lParam), "#32770") > 0 Then
                  Icount = 0 'm_ActiveClassesNumber
                  EnumChildWindows lParam, AddressOf EnumChildProc, ByVal 0&
              End If
                              '//--Support For MessageBox
              
              If m_CommonD And InStr(ThisWindowClassName(lParam), "NewHelpClass") > 0 Then
                If hHook Then UnhookWindowsHookEx hHook
                hHook = SetWindowsHookEx(WH_CALLWNDPROC, AddressOf AppHook, App.hInstance, App.ThreadID)
              End If
                              '//--Support For CommonDialog




'==========================================================================================
'==========================================================================================
'An application sends the WM_PAINT message when the system or another application makes a request
'to paint a portion of an application's window. The message is sent when the UpdateWindow or
'RedrawWindow function is called, or by theDispatchMessage function when the application obtains
'a WM_PAINT message by using theGetMessage orPeekMessage function
   
   
   Case WM_PAINT
        
    If m_Button Then
    
        If IsWindowEnabled(m_hWnd) Then
            PrePaintControl
            ISubclass_WindowProc = CallOldWindowProc(hwnd, iMsg, OrigDC, lParam)
        End If
    
        PostPaintControl
  
    ElseIf Not m_ProgressBar Then
  
        DrawControlClass
    
    End If
  
'==========================================================================================
'==========================================================================================
'The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the
'cursor is in the client area of a window. If the mouse is not captured, the message is posted
'to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

    Case WM_LBUTTONDOWN
     m_CBug = True
     bDown = True
     ButtonState = C_Down
 
     RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
      
          
     
'==========================================================================================
'==========================================================================================
'The WM_LBUTTONUP message is posted when the user releases the left mouse button while the
'cursor is in the client area of a window. If the mouse is not captured, the message is posted
'to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.
   
   Case WM_LBUTTONUP
       
   
   m_CBug = True
   bDown = False
   ButtonState = C_Up
   
              
        
   '//---Slider XP Controls Hover Area (Hover Area only inside of THUMB)
   
   If m_Slider Then
           If CheckSliderArea = True Then ButtonState = C_Over
           If CheckSliderArea = False Then ButtonState = C_Normal
   
   ElseIf m_Adodc Then
      
           MovementFlag = C_Disabled
           SetTimer m_hWnd, 1, 1, 0
        
        
   '//---Ugly but must repaint every optionbutton control in actual container every time it changes value
   '     because can 't seem to get right values with ownerdraw buttons except for graphic styled one's
                
        'Solution:
   ElseIf m_Option Then
           If InsideArea(m_hWnd) = True Then
                EnumChildWindows GetParent(m_hWnd), AddressOf CleanOptionButtomArray, ByVal 0&
           Else
                DrawControlClass        '//--This Works for None-Graphic & None-OwnedDraw OptionButtons
           End If
   ElseIf m_TabStrip Then
   
   
   Else
          
          RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
   
   End If
                         
        
   m_CurrentItem = -1
       
        
        
'==========================================================================================
'==========================================================================================
'The WM_ENABLE message is sent when an application changes the enabled state of a window.
'It is sent to the window whose enabled state is changing. This message is sent before the
'EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed.
   
   
   Case WM_ENABLE

       If IsWindowEnabled(m_hWnd) = 0 Then
            ButtonState = C_Disabled
       Else
            ButtonState = C_Normal
       End If
    
       RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
         
'==========================================================================================
'==========================================================================================
'The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus.


    Case WM_SETFOCUS
                
'         ButtonState = C_Disabled
          
          isFocused = True
          
          If m_Button Then
             PostPaintControl

          Else
             RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
    
          End If

'==========================================================================================
'==========================================================================================
'The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.

    Case WM_KILLFOCUS
        
'        ButtonState = C_Disabled
        isFocused = False
        PostPaintControl


'==========================================================================================
'==========================================================================================
'The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed.
'A nonsystem key is a key that is pressed when the alt key is not pressed.

       
    Case WM_KEYDOWN
        
            If Not bDown Then
                
                bDown = True
                
                LongInt2Int wParam, iHw, iLW
            
                Select Case (iLW)
                
                    Case vbKeySpace
         
                     RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
             
                End Select
                 
                 
             End If

'==========================================================================================
'==========================================================================================
'The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released.
'A nonsystem key is a key that is pressed when the alt key is not pressed, or a keyboard key
'that is pressed when a window has the keyboard focus.
     
     Case WM_KEYUP
            
             
             If bDown Then
                
                bDown = False
                
                LongInt2Int wParam, iHw, iLW
            
                Select Case (iLW)
                
                    Case vbKeySpace
         
                     RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
             
                 End Select
                 
                 
             End If
             
     
'==========================================================================================
'==========================================================================================
'The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not
'captured,the message is posted to the window that contains the cursor. Otherwise, the message
'is posted to the window that has captured the mouse.

   
   Case WM_MOUSEMOVE
  
   If m_Button Or m_CheckBox Or m_Option Then
                        
      If InsideArea(m_hWnd) = True Then
           If bOver = False Then
                 bOver = True
                 RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
                 SetTimer m_hWnd, 1, 1, 0
            End If
            
      Else
           If bOver Then
                  RedrawWindow m_hWnd, ByVal 0&, ByVal 0&, &H1 '//---(invoke a Paint-event) ..See WM_PAINT For Details
                  bOver = False
           End If
      End If
            
    ElseIf m_Adodc Then
        
        If MyClassObject.Enabled Then
          If CheckAdodcArea = True Then
             SetTimer m_hWnd, 1, 1, 0
             DrawControlClass
          End If
        End If
        
     ElseIf m_Slider Then
        
         If CheckSliderArea = True And bOver = False And bDown = False Then
            ButtonState = C_Over
            bOver = True
            DrawControlClass
         End If
           
         If CheckSliderArea = False And bOver = True And bDown = False Then
            ButtonState = C_Normal
            bOver = False
            DrawControlClass
         End If
     

⌨️ 快捷键说明

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