mdlHover.bas
资源名称:smiley.rar [点击查看]
上传用户:hx800c
上传日期:2020-12-02
资源大小:792k
文件大小:7k
源码类别:
编辑框
开发平台:
Visual Basic
- Attribute VB_Name = "mdlHover"
- Public Const LOGPIXELSY = 90 ' Logical pixels/inch in Y
- Public Const LF_FACESIZE = 32
- Public Const DT_BOTTOM = &H8
- Public Const DT_CENTER = &H1
- Public Const DT_LEFT = &H0
- Public Const DT_RIGHT = &H2
- Public Const DT_TOP = &H0
- Public Const DT_VCENTER = &H4
- Public Const DT_SINGLELINE = &H20
- Public Const DT_WORDBREAK = &H10
- Public Const DT_CALCRECT = &H400
- Public Const DT_END_ELLIPSIS = &H8000
- Public Const DT_MODIFYSTRING = &H10000
- Public Const DT_WORD_ELLIPSIS = &H40000
- Public Const COLOR_BTNHIGHLIGHT = 20
- Public Const COLOR_BTNSHADOW = 16
- Public Const COLOR_BTNFACE = 15
- Public Const COLOR_HIGHLIGHT = 13
- Public Const COLOR_ACTIVEBORDER = 10
- Public Const COLOR_WINDOWFRAME = 6
- Public Const COLOR_3DDKSHADOW = 21
- Public Const COLOR_3DLIGHT = 22
- Public Const COLOR_INFOTEXT = 23
- Public Const COLOR_INFOBK = 24
- Public Const PATCOPY = &HF00021 ' (DWORD) dest = pattern
- Public Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
- Public Const PS_SOLID = 0
- Public Const PS_DASHDOT = 3 ' _._._._
- Public Const PS_DASHDOTDOT = 4 ' _.._.._
- Public Const PS_DOT = 2 ' .......
- Public Const PS_DASH = 1 ' -------
- Public Const PS_ENDCAP_FLAT = &H200
- Public Type LOGFONT
- lfHeight As Long
- lfWidth As Long
- lfEscapement As Long
- lfOrientation As Long
- lfWeight As Long
- lfItalic As Byte
- lfUnderline As Byte
- lfStrikeOut As Byte
- lfCharSet As Byte
- lfOutPrecision As Byte
- lfClipPrecision As Byte
- lfQuality As Byte
- lfPitchAndFamily As Byte
- lfFaceName(1 To LF_FACESIZE) As Byte
- End Type
- Public Type RECT
- Left As Long
- Top As Long
- Right As Long
- Bottom As Long
- End Type
- Public Type POINTAPI
- x As Long
- y As Long
- End Type
- Public Type LOGPEN
- lopnStyle As Long
- lopnWidth As POINTAPI
- lopnColor As Long
- End Type
- Public Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
- Public Declare Function SelectClipPath Lib "gdi32" (ByVal hdc As Long, ByVal iMode As Long) As Long
- Public Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
- Public Declare Function CreateRectRgnIndirect Lib "gdi32" (lpRect As RECT) As Long
- Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
- Public Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
- Public Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
- Public Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
- Public Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
- Public Declare Function GetCapture Lib "user32" () As Long
- Public Declare Function ReleaseCapture Lib "user32" () As Long
- Public Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
- Public Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
- Public Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
- Public Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
- Public Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
- Public Declare Function SetTextColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
- Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
- Public Declare Function CreatePenIndirect Lib "gdi32" (lpLogPen As LOGPEN) As Long
- Public Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
- Public Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
- Public Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As Long) As Long
- Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
- Public Declare Function InflateRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
- Public Declare Function DrawFocusRect Lib "user32" (ByVal hdc As Long, lpRect As RECT) As Long
- Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
- Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
- Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
- Public Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long
- Public Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
- Public Declare Function GetDesktopWindow Lib "user32" () As Long
- Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
- Public Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
- Public Declare Function OffsetRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
- 'Convert string into Byte Array to be used with LOGFONT structure
- Public Sub FillIntoArray(Source As String, dest() As Byte)
- For i = 1 To Len(Source)
- dest(i) = Asc(Mid(Source, i, 1))
- Next
- End Sub
- Public Function GetLogicalSizeFromPoint(hdc As Long, nPointSize As Long) As Long
- GetLogicalSizeFromPoint = -((nPointSize * GetDeviceCaps(hdc, LOGPIXELSY)) / 72) + 1
- End Function
- 'Select font for caption of button
- Public Function SelectFont(hdc As Long, m_Font As StdFont, Optional Color As Long) As Long
- 'Selects the specified font into current device context
- On Error Resume Next
- Dim m As LOGFONT
- Dim fnt As Long
- With m_Font
- FillIntoArray .Name, m.lfFaceName
- m.lfWeight = .Weight
- m.lfCharSet = .Charset
- m.lfItalic = .Italic
- m.lfHeight = GetLogicalSizeFromPoint(hdc, .Size)
- End With
- fnt = CreateFontIndirect(m)
- If Not IsMissing(Color) Then
- SetTextColor hdc, Color
- End If
- SelectObject hdc, fnt
- SelectFont = fnt
- End Function