http://www.dapha.net/vb/down.asp?id=1705软件名称 多种效果的ToolTipText  
软件类型  
运行环境 VB5.0/Win9x 
授权方式 免费代码 
软件大小 K 
软件评价  
上传时间 2002-3-11 
相关链接 主页 
本日下载 2  本周:133  总计:133 
下载地址1 下载 
软件简介 多种效果的ToolTipText,VB自带那些控件的Tooltip是不是又老又土啊?如果你想做出漂亮的Tooltip用这个代码试试. 
http://www.dapha.net/vb/down.asp?id=1287
软件名称 tooltips  
软件类型  
运行环境 VB6.0/Win9x 
授权方式 免费代码 
软件大小 23K 
软件评价  
上传时间 2001-12-15 
相关链接 主页 
本日下载 1  本周:139  总计:139 
下载地址1 下载 
软件简介 Tooltips一般用于解释一个控件的用途,是给用户一个提示。这里的tooltips不是VB自带的,是自己设计出来的,颜色不同.大小不同,而且是圆边. 
http://www.dapha.net/vb/down.asp?id=780
软件名称 Tooltip控件  
软件类型  
运行环境 VB6.0/Win9x 
授权方式 免费代码 
软件大小 13K 
软件评价  
上传时间 2001-12-4 
相关链接 主页 
本日下载 2  本周:54  总计:113 
下载地址1 下载 
软件简介 完美的TOOLTIP. 

解决方案 »

  1.   

    用以下方法试试:
    在模块中声明一个公有的字符型变量
    public strtooltip as string
    制作一个窗体,上面放一个label
    在窗体的load事件中加入以下代码
    label1.caption=strtooltip
    当鼠标移到控件上时设置要显示的信息到strtooltip,然后显示这个窗体
    在鼠标移出控件时卸载窗体
      

  2.   

    cls里面
    Option Explicit
    Private Declare Sub InitCommonControls Lib "comctl32.dll" ()''Windows API Functions
    Private Declare Function CreateWindowEx Lib "User32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
    Private Declare Function SendMessageAny Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function DestroyWindow Lib "User32" (ByVal hWnd As Long) As Long
    Private Declare Function GetClientRect Lib "User32" (ByVal hWnd As Long, lpRect As RECT) As Long''Windows API Constants
    Private Const WM_USER = &H400
    Private Const CW_USEDEFAULT = &H80000000
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOACTIVATE = &H10
    Private Const SWP_NOMOVE = &H2
    Private Const HWND_TOPMOST = -1''Windows API Types
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type''Tooltip Window Constants
    Private Const TTS_NOPREFIX = &H2
    Private Const TTF_TRANSPARENT = &H100
    Private Const TTF_CENTERTIP = &H2
    Private Const TTM_ADDTOOLA = (WM_USER + 4)
    Private Const TTM_ACTIVATE = WM_USER + 1
    Private Const TTM_UPDATETIPTEXTA = (WM_USER + 12)
    Private Const TTM_SETMAXTIPWIDTH = (WM_USER + 24)
    Private Const TTM_SETTIPBKCOLOR = (WM_USER + 19)
    Private Const TTM_SETTIPTEXTCOLOR = (WM_USER + 20)
    Private Const TTM_SETTITLE = (WM_USER + 32)
    Private Const TTS_BALLOON = &H40
    Private Const TTS_ALWAYSTIP = &H1
    Private Const TTF_SUBCLASS = &H10
    Private Const TOOLTIPS_CLASSA = "tooltips_class32"''Tooltip Window Types
    Private Type TOOLINFO
        lSize As Long
        lFlags As Long
        lHwnd As Long
        lId As Long
        lpRect As RECT
        hInstance As Long
        lpStr As String
        lParam As Long
    End Type
    'local variable(s) to hold property value(s)
    Private mvarBackColor As Long 'local copy
    Private mvarTitle As String 'local copy
    Private mvarForeColor As Long 'local copy
    Private mvarParentControl As Object 'local copy
    Private mvarIcon As ttIconType 'local copy
    Private mvarCentered As Boolean 'local copy
    Private mvarStyle As ttStyleEnum  'local copy
    Private mvarTipText As StringPublic Enum ttIconType
        TTNoIcon = 0
        TTIconInfo = 1
        TTIconWarning = 2
        TTIconError = 3
    End EnumPublic Enum ttStyleEnum
        TTStandard
        TTBalloon
    End Enum'private data
    Private lHwnd As Long
    Private Ti As TOOLINFOPublic Property Let Style(ByVal vData As ttStyleEnum)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.Style = 5
        mvarStyle = vData
    End PropertyPublic Property Get Style() As ttStyleEnum
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.Style
        Style = mvarStyle
    End PropertyPublic Property Let Centered(ByVal vData As Boolean)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.Centered = 5
        mvarCentered = vData
    End PropertyPublic Property Get Centered() As Boolean
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.Centered
        Centered = mvarCentered
    End PropertyPublic Function Create() As Boolean
        Dim lpRect As RECT
        Dim lWinStyle As Long
        
        If lHwnd <> 0 Then
            DestroyWindow lHwnd
        End If
        
        lWinStyle = TTS_ALWAYSTIP Or TTS_NOPREFIX
        
        ''create baloon style if desired
        If mvarStyle = TTBalloon Then lWinStyle = lWinStyle Or TTS_BALLOON
        
        ''the parent control has to have been set first
        If Not mvarParentControl Is Nothing Then
            lHwnd = CreateWindowEx(0&, _
                        TOOLTIPS_CLASSA, _
                        vbNullString, _
                        lWinStyle, _
                        CW_USEDEFAULT, _
                        CW_USEDEFAULT, _
                        CW_USEDEFAULT, _
                        CW_USEDEFAULT, _
                        mvarParentControl.hWnd, _
                        0&, _
                        App.hInstance, _
                        0&)
                        
            ''make our tooltip window a topmost window
            SetWindowPos lHwnd, _
                HWND_TOPMOST, _
                0&, _
                0&, _
                0&, _
                0&, _
                SWP_NOACTIVATE Or SWP_NOSIZE Or SWP_NOMOVE
                        
            ''get the rect of the parent control
            GetClientRect mvarParentControl.hWnd, lpRect
            
            ''now set our tooltip info structure
            With Ti
                ''if we want it centered, then set that flag
                If mvarCentered Then
                    .lFlags = TTF_SUBCLASS Or TTF_CENTERTIP
                Else
                    .lFlags = TTF_SUBCLASS
                End If
                
                ''set the hwnd prop to our parent control's hwnd
                .lHwnd = mvarParentControl.hWnd
                .lId = 0
                .hInstance = App.hInstance
                '.lpstr = ALREADY SET
                .lpRect = lpRect
            End With
            
            ''add the tooltip structure
            SendMessageAny lHwnd, TTM_ADDTOOLA, 0&, Ti
            
            ''if we want a title or we want an icon
            If mvarTitle <> vbNullString Or mvarIcon <> TTNoIcon Then
                SendMessageAny lHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
            End If
            
            If mvarForeColor <> Empty Then
                SendMessageAny lHwnd, TTM_SETTIPTEXTCOLOR, mvarForeColor, 0&
            End If
            
            If mvarBackColor <> Empty Then
                SendMessageAny lHwnd, TTM_SETTIPBKCOLOR, mvarBackColor, 0&
            End If
            
        End If
    End FunctionPublic Property Set ParentControl(ByVal vData As Object)
    'used when assigning an Object to the property, on the left side of a Set statement.
    'Syntax: Set x.ParentControl = Form1
        Set mvarParentControl = vData
    End PropertyPublic Property Get ParentControl() As Object
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.ParentControl
        Set ParentControl = mvarParentControl
    End Property
      

  3.   

    Public Property Let Icon(ByVal vData As ttIconType)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.Icon = 5
        mvarIcon = vData
        If lHwnd <> 0 And mvarTitle <> Empty And mvarIcon <> TTNoIcon Then
            SendMessageAny lHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
        End IfEnd PropertyPublic Property Get Icon() As ttIconType
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.Icon
        Icon = mvarIcon
    End Property
    Public Property Let ForeColor(ByVal vData As Long)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.ForeColor = 5
        mvarForeColor = vData
        If lHwnd <> 0 Then
            SendMessageAny lHwnd, TTM_SETTIPTEXTCOLOR, mvarForeColor, 0&
        End IfEnd PropertyPublic Property Get ForeColor() As Long
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.ForeColor
        ForeColor = mvarForeColor
    End PropertyPublic Property Let Title(ByVal vData As String)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.Title = 5
        mvarTitle = vData
        If lHwnd <> 0 And mvarTitle <> Empty And mvarIcon <> TTNoIcon Then
            SendMessageAny lHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
        End If
    End PropertyPublic Property Get Title() As String
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.Title
        Title = Ti.lpStr
    End PropertyPublic Property Let BackColor(ByVal vData As Long)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.BackColor = 5
        mvarBackColor = vData
        If lHwnd <> 0 Then
            SendMessageAny lHwnd, TTM_SETTIPBKCOLOR, mvarBackColor, 0&
        End If
        
    End PropertyPublic Property Get BackColor() As Long
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.BackColor
        BackColor = mvarBackColor
    End PropertyPublic Property Let TipText(ByVal vData As String)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.TipText = 5
        Ti.lpStr = vData
        If lHwnd <> 0 Then
            SendMessageAny lHwnd, TTM_UPDATETIPTEXTA, 0&, Ti
        End If
        
    End PropertyPublic Property Get TipText() As String
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.TipText
        TipText = mvarTipText
    End PropertyPrivate Sub Class_Terminate()
        If lHwnd <> 0 Then
            DestroyWindow lHwnd
        End If
        
    End Sub调用    Set TBTopTip = New clsTopTip
        TBTopTip.Style = TTBalloon
        TBTopTip.TipText = tbTipText
        Set TBTopTip.ParentControl = PicICON
        TBTopTip.Title = tbTitle
        TBTopTip.Icon = 0
        TBTopTip.Create
        ButtonUD = ZCBUD
      

  4.   

    Public Property Let Icon(ByVal vData As ttIconType)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.Icon = 5
        mvarIcon = vData
        If lHwnd <> 0 And mvarTitle <> Empty And mvarIcon <> TTNoIcon Then
            SendMessageAny lHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
        End IfEnd PropertyPublic Property Get Icon() As ttIconType
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.Icon
        Icon = mvarIcon
    End Property
    Public Property Let ForeColor(ByVal vData As Long)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.ForeColor = 5
        mvarForeColor = vData
        If lHwnd <> 0 Then
            SendMessageAny lHwnd, TTM_SETTIPTEXTCOLOR, mvarForeColor, 0&
        End IfEnd PropertyPublic Property Get ForeColor() As Long
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.ForeColor
        ForeColor = mvarForeColor
    End PropertyPublic Property Let Title(ByVal vData As String)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.Title = 5
        mvarTitle = vData
        If lHwnd <> 0 And mvarTitle <> Empty And mvarIcon <> TTNoIcon Then
            SendMessageAny lHwnd, TTM_SETTITLE, CLng(mvarIcon), ByVal mvarTitle
        End If
    End PropertyPublic Property Get Title() As String
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.Title
        Title = Ti.lpStr
    End PropertyPublic Property Let BackColor(ByVal vData As Long)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.BackColor = 5
        mvarBackColor = vData
        If lHwnd <> 0 Then
            SendMessageAny lHwnd, TTM_SETTIPBKCOLOR, mvarBackColor, 0&
        End If
        
    End PropertyPublic Property Get BackColor() As Long
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.BackColor
        BackColor = mvarBackColor
    End PropertyPublic Property Let TipText(ByVal vData As String)
    'used when assigning a value to the property, on the left side of an assignment.
    'Syntax: X.TipText = 5
        Ti.lpStr = vData
        If lHwnd <> 0 Then
            SendMessageAny lHwnd, TTM_UPDATETIPTEXTA, 0&, Ti
        End If
        
    End PropertyPublic Property Get TipText() As String
    'used when retrieving value of a property, on the right side of an assignment.
    'Syntax: Debug.Print X.TipText
        TipText = mvarTipText
    End PropertyPrivate Sub Class_Terminate()
        If lHwnd <> 0 Then
            DestroyWindow lHwnd
        End If
        
    End Sub调用    Set TBTopTip = New clsTopTip
        TBTopTip.Style = TTBalloon
        TBTopTip.TipText = tbTipText
        Set TBTopTip.ParentControl = PicICON
        TBTopTip.Title = tbTitle
        TBTopTip.Icon = 0
        TBTopTip.Create
        ButtonUD = ZCBUD