Professional Documents
Culture Documents
Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal
nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
Private Declare Function GetBkColor Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function GetTextColor Lib "gdi32" (ByVal hDC As Long) As Long
Private Declare Function SetBkColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Private Declare Function SetTextColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA" (ByVal lpFileName As
String) As Long
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
TabCaptionSingleLine = DT_SINGLELINE
TabCaptionWordWrap = DT_WORDBREAK
TabCaptionEllipsis = DT_WORD_ELLIPSIS
TabCaptionNoPrefix = DT_NOPREFIX
End Enum
Public Event TabClick(ByVal TabIndex As Long)
sCaption As String
sTag As String
sKey As String
ItemData As Long
Left As Long
Width As Long
Image As Long
Enabled As Boolean
Visible As Boolean
Active As Boolean
Top As Long
Height As Long
Right As Long
Bottom As Long
End Type
ctlName As String
iTabIndex As Long
End Type
ssDisabled
ssNormal
ssDown
ssHover
End Enum
' store control name, index and tabIndex: ctl1(0)1 or clt1()1 if there is no index
'Private ctlLst() As New Collection ', visibleCTLs As New Collection
'=========================================================================
'=========================================================================
End Function
Private Function InitSubclassingThunk(ByVal hWnd As Long, pObj As Object, ByVal pfnCallback As Long) As
IUnknown
aParams(0) = ObjPtr(pObj)
aParams(1) = pfnCallback
If hThunk = 0 Then
hThunk = pvThunkGlobalData("InitSubclassingThunk")
End If
#End If
If hThunk = 0 Then
Debug.Assert pvGetIdeOwner(aParams(7))
End If
pvThunkGlobalData("InitSubclassingThunk") = hThunk
#End If
End If
End Function
Private Property Get ThunkPrivateData(pThunk As IUnknown, Optional ByVal Index As Long) As Long
lPtr = ObjPtr(pThunk)
End If
End Property
Do
#End If
pvGetIdeOwner = True
End Function
sBuffer = String$(50, 0)
Call GetEnvironmentVariable("_MST_GLOBAL" & App.hInstance & "_" & sKey, sBuffer, Len(sBuffer) - 1)
End Property
End Property
#End If
pvUnsubclass
End If
End Sub
End Sub
Public Function SubclassProc(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long, Handled As Boolean) As Long
'Dim x As Single
'Dim y As Single
'
'
' End If
Handled = True
Exit Function
End If
Dim x As Single
Dim y As Single
' End If
lTab = selIndex
Handled = True
SubclassProc = 0
Exit Function
End If
' End If
' End If
End Select
Handled = False
iSM = UserControl.ScaleMode
UserControl.ScaleMode = vbTwips
GetCursorPos iPt
iWidth = -1
iWidth = iCtl.Width
MouseIsOverAContainedControl = True
Err.Clear
Exit Function
End If
End If
End If
End If
End If
Next
Err.Clear
UserControl.ScaleMode = iSM
End Function
hWnd = UserControl.hWnd
End Property
GetCursorPos Pos
End If
End Sub
Exit Sub
End If
lScrollX = lScrollX + 10
lScrollX = lScrollWidth
RightSliderStatus = ssDisabled
tmrSlide.Enabled = False
Me.Refresh
Exit Sub
End If
LeftSliderStatus = ssNormal
Else
lScrollX = lScrollX - 10
lScrollX = 0
LeftSliderStatus = ssDisabled
tmrSlide.Enabled = False
Me.Refresh
Exit Sub
End If
RightSliderStatus = ssNormal
End If
'Draw
Me.Refresh
End Sub
End Sub
bInFocus = True
Me.Refresh
End Sub
bInFocus = False
Me.Refresh
End Sub
Me.Refresh
End Sub
Dim c As Long
On Error GoTo 0
mUserMode = Ambient.UserMode
mUserControlHwnd = UserControl.hWnd
mContainerHwnd = UserControl.ContainerHwnd
mUserControlHdc = UserControl.hDC
pvSubclass
CreateGraphicsDC
For c = 1 To 4
Next
End Sub
Dim c As Long
For c = 0 To m_TabCount - 1
getTabOrder = c
Exit For
End If
Next
End Function
lTab = getTabOrder(selIndex)
NextTab:
lCount = lCount + 1
Case vbKeyLeft
End If
lTab = lTab - 1
End If
Case vbKeyRight
lTab = -1 '0
End If
lTab = lTab + 1
End If
End Select
If lTab >= 0 And lTab < m_TabCount And lCount < m_TabCount Then
GoTo NextTab:
End If
End If
lTab = m_TabOrder(lTab)
RaiseEvent TabClick(lTab)
SelectedItem = lTab
End If
End Sub
mUserControlHdc = hDC
' Draw
Me.Refresh
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
selIndex = PropBag.ReadProperty("SelectedItem", 0)
m_TabCount = PropBag.ReadProperty("ItemCount", 4)
ReDim m_Tabs(m_TabCount - 1)
ReDim m_TabOrder(m_TabCount - 1)
ReDim ctlLst(m_TabCount - 1)
m_ctlCount = 0
ReDim m_Ctls(m_ctlCount)
For i = 0 To m_TabCount - 1
' m_TabOrder(I) = I
For z = 0 To mCCount - 1
m_Ctls(m_ctlCount).ctlName = ctlName
m_Ctls(m_ctlCount).iTabIndex = i
m_ctlCount = m_ctlCount + 1
End If
Next z
Next i
ItemMax = PropBag.ReadProperty("ItemMax", 0)
For z = 0 To mCCount - 1
m_Ctls(m_ctlCount).ctlName = ctlName
m_Ctls(m_ctlCount).iTabIndex = i
m_ctlCount = m_ctlCount + 1
End If
Next z
Next
If selIndex > m_TabCount - 1 Then
selIndex = m_TabCount - 1
End If
SelectedItem = selIndex
On Error GoTo 0
mUserMode = Ambient.UserMode
mUserControlHwnd = UserControl.hWnd
mContainerHwnd = UserControl.ContainerHwnd
mUserControlHdc = UserControl.hDC
pvSubclass
CreateGraphicsDC
' Draw
Me.Refresh
End Sub
'
c=0
For z = 0 To m_ctlCount - 1
If m_Ctls(z).iTabIndex = i Then
PropBag.WriteProperty "Item(" & i & ").Control(" & c & ")", m_Ctls(z).ctlName, ""
c=c+1
End If
MaxIndex = m_Ctls(z).iTabIndex
End If
Next z
Next i
c=0
For z = 0 To m_ctlCount - 1
If m_Ctls(z).iTabIndex = i Then
PropBag.WriteProperty "Item(" & i & ").Control(" & c & ")", m_Ctls(z).ctlName, ""
c=c+1
End If
Next z
Next
End Sub
End Function
Private Sub TransBlt(ByVal hdcScreen As Long, ByVal hdcDest As Long, ByVal xDest As Long, ByVal yDest As
Long, _
ByVal xSrc As Long, ByVal ySrc As Long, ByVal nWidthSrc As Long, ByVal nHeightSrc As Long, ByVal
clrMask As OLE_COLOR)
'=====================================================
lMaskColor = TranslateColor(clrMask)
Lib = LoadLibrary("gdi32.dll")
FreeLibrary Lib
'works on XP
GdiTransparentBlt hdcDest, xDest, yDest, nWidth, nHeight, hdcSrc, xSrc, ySrc, nWidthSrc, nHeightSrc,
lMaskColor
'Debug.Print "Gdi transparent blt"
End If
'=====================================================
lMaskColor = TranslateColor(clrMask)
hdcScnBuffer = CreateCompatibleDC(hdcScreen)
Call StretchBlt(hdcColor, 0, 0, nWidth, nHeight, hdcSrc, xSrc, ySrc, nWidthSrc, nHeightSrc, vbSrcCopy)
hdcMask = CreateCompatibleDC(hdcScreen)
'clear
DeleteDC hdcColor
DeleteDC hdcScnBuffer
DeleteObject SelectObject(hdcMask, hbmMaskOld)
DeleteDC hdcMask
'ReleaseDC 0, hdcScreen
End Sub