Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1612908
  • 博文数量: 585
  • 博客积分: 14610
  • 博客等级: 上将
  • 技术积分: 7402
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-15 10:52
文章存档

2013年(5)

2012年(214)

2011年(56)

2010年(66)

2009年(44)

2008年(200)

分类: C/C++

2012-01-27 01:43:38

 MSDN对ToolTip的介绍
分类: 2.1 VC++/MFC 367人阅读 评论(0) 收藏 举报
Tooltip

This section contains information about the programming elements used with tooltip controls.

本节包含工具提示控件使用的编程元素的信息。

Overviews

Topic

Contents

Tooltips appear automatically, or pop up, when the user pauses the mouse pointer over a tool or some other UI element.

当用户在工具或其它一些UI元素暂停鼠标指针移到,Tooltips会自动出现,或者弹出。

This section contains examples that demonstrate how to create different types of tooltips.

本节包含了一些例子,演示如何创建不同类型的Tooltips。

 

Messages

Topic

Contents

Activates or deactivates a tooltip control.

激活或停用的Tooltips控件。

Registers a tool with a tooltip control.

注册一个带Tooltips控件的工具。

Calculates a tooltip control's text display rectangle from its window rectangle, or the tooltip window rectangle needed to display a specified text display rectangle.

计算一个tooltip控件其窗口矩形的文本显示矩形,或需要显示指定的文本显示矩形的tooltip窗口的矩形。

Removes a tool from a tooltip control.

从tooltip控件移除一个工具。

Retrieves the information that a tooltip control maintains about the current tool—that is, the tool for which the tooltip is currently displaying text.

获取tooltip控件维持的当前工具信息,也就是当前tooltip正在显示文本的工具的信息。

Returns the width and height of a tooltip control.

返回tooltip控件的宽度和高度

Retrieves the information for the current tool in a tooltip control.

获取tooltip控件里当前工具的信息

Retrieves the initial, pop-up, and reshow durations currently set for a tooltip control.

获取当前设置一个tooltip控件初始化,弹出,重新显示的持续时间。

Retrieves the top, left, bottom, and right margins set for a tooltip window. A margin is the distance, in pixels, between the tooltip window border and the text contained within the tooltip window.

获取一个tooltip窗口的顶部,左侧,底部和右侧边距设置。边距的距离,以像素为单位,在tooltip窗口边框和tooltip窗口内包含的文本之间。

Retrieves the maximum width for a tooltip window.

获取一个tooltip窗口的最大宽度。

Retrieves the information a tooltip control maintains about a tool.

获取一个tooltip控件维持的一个工具的信息。

Retrieves the background color in a tooltip window.

获取一个tooltip窗口的背景颜色。

Retrieves the text color in a tooltip window.

获取一个tooltip窗口的文本颜色。

Retrieve information concerning the title of a tooltip control.

获取一个tooltip控件的标题信息。

Retrieves a count of the tools maintained by a tooltip control.

获取一个tooltip控件所维持的工具计数。

Retrieves the information that a tooltip control maintains about a tool.

获取一个tooltip控件维持的关于一个工具的信息。

Tests a point to determine whether it is within the bounding rectangle of the specified tool and, if it is, retrieves information about the tool.

测试一个点来确定是否它是在指定的工具的矩形边界内,如果是,获取有关这个工具的信息。

Sets a new bounding rectangle for a tool.

设置一个工具新的矩形边界。

Removes a displayed tooltip window from view.

从视图移除一个显示的tooltip窗口。

Causes the tooltip to display at the coordinates of the last mouse message.

使tooltip显示在最后鼠标消息的坐标。

Passes a mouse message to a tooltip control for processing.

通过鼠标消息进行处理的tooltip控件。

Sets the initial, pop-up, and reshow durations for a tooltip control.

设置一个tooltip控件的初始化,弹出和重新显示持续时间。

Sets the top, left, bottom, and right margins for a tooltip window. A margin is the distance, in pixels, between the tooltip window border and the text contained within the tooltip window.

设置一个tooltip窗口的顶部,左侧,底部和右侧边距设置。边距的距离,以像素为单位,在tooltip窗口边框和tooltip窗口内包含的文本之间。

Sets the maximum width for a tooltip window.

设置一个tooltip窗口的最大宽度。

Sets the background color in a tooltip window.

设置一个tooltip窗口的背景颜色。

Sets the text color in a tooltip window.

设置一个tooltip窗口的文本颜色。

Adds a standard icon and title string to a tooltip.

设置一个tooltip控件的标题信息。

Sets the information that a tooltip control maintains for a tool.

设置一个tooltip控件维持的关于一个工具的信息。

Sets the visual style of a tooltip control.

设置一个tooltip控件的视觉风格。

Activates or deactivates a tracking tooltip.

激活或停用一个跟踪tooltip。

Sets the position of a tracking tooltip.

设置一个跟踪tooltip的位置。

Forces the current tooltip to be redrawn.

强制当前tooltip被重绘。

Sets the tooltip text for a tool.

设置一个工具的tooltip文本。

Allows a subclass procedure to cause a tooltip to display text for a window other than the one beneath the mouse cursor.

允许一个子类的过程引起一个tooltip为一个鼠标光标下方以外的窗口显示文本。

 

Notifications

Topic

Contents

Sent by a tooltip control to notify its parent windows about drawing operations. This notification code is sent in the form of a message.

一个tooltip控件发送通知它的父窗口绘制操作。此通知代码是在一个WM_NOTIFY消息的形式发送。

Sent by a tooltip control to retrieve information needed to display a tooltip window. This notification code is sent in the form of a message.

一个tooltip控件发送去获取需要显示一个tooltip窗口的信息。此通知代码是在一个WM_NOTIFY消息的形式发送。

Sent when a text link inside a balloon tooltip is clicked.

当气泡tooltip内的文本链接被点击时发送。

Sent by a tooltip control to retrieve information needed to display a tooltip window. This notification is identical to. This notification code is sent in the form of a message.

一个tooltip控件发送去获取需要显示一个提示窗口的信息。这个通知是相同TTN_GETDISPINFO的。此通知代码是在一个WM_NOTIFY消息的形式发送。

Notifies the owner window that a tooltip is about to be hidden. This notification code is sent in the form of a message.

通知所有者窗口,一个tooltip将被隐藏。此通知代码是在一个WM_NOTIFY消息的形式发送。

Notifies the owner window that a tooltip control is about to be displayed. This notification code is sent in the form of a message.

通知所有者窗口将要显示的tooltip控件。此通知代码是在一个WM_NOTIFY消息的形式发送。

 

Structures

Topic

Contents

Contains information specific to an  notification code sent by a tooltip control.

包含一个tooltip控件发送NM_CUSTOMDRAW通知代码信息。

Contains information used in handling the  notification code. This structure supersedes the TOOLTIPTEXT structure.

包含用于处理TTN_GETDISPINFO通知代码的信息。这种结构取代的ToolTipText结构。

The  structure contains information about a tool in a tooltip control.

TOOLINFO结构包含一个tooltip控件的工具的信息。

Provides information about the title of a tooltip control.

提供一个tooltip控件的标题信息。

Contains information that a tooltip control uses to determine whether a point is in the bounding rectangle of the specified tool. If the point is in the rectangle, the structure receives information about the tool.

包含一个tooltip控件使用,以确定一个点是否在指定的工具的边界矩形的信息。如果点在矩形内,结构收到有关该工具的信息。

 

Constants

Topic

Contents

This section lists the control styles used with tooltip controls.

本节列出了tooltip控件使用的控件样式。


Tooltip Styles

This section lists the control styles used with tooltip controls.

本节列出了tooltip控件使用的控件样式。

Constant

Description

TTS_ALWAYSTIP

Indicates that the tooltip control appears when the cursor is on a tool, even if the tooltip control's owner window is inactive. Without this style, the tooltip appears only when the tool's owner window is active.

指示当光标在工具上,tooltip控件出现,即使tooltip控件的所有者窗口处于非活动状态。没有这种风格,只有当工具的所有者窗口活动时,才出现tooltip控件。

TTS_BALLOON

. Indicates that the tooltip control has the appearance of a cartoon "balloon," with rounded corners and a stem pointing to the item.

指示tooltip控件的卡通“气球”外观,带圆角和一个指向该项目的箭头。

TTS_CLOSE

Displays a Close button on the tooltip. Valid only when the tooltip has the TTS_BALLOON style and a title; see.

显示关闭按钮的tooltip。仅当工具提示TTS_BALLOON风格和标题;见TTM_SETTITLE。

TTS_NOANIMATE

. Disables sliding tooltip animation on Windows 98 and Windows 2000 systems. This style is ignored on earlier systems.

在Windows 98和Windows 2000系统的tooltip动画禁用滑动。这种风格被早期的系统忽略。

TTS_NOFADE

. Disables fading tooltip animation on Windows 2000 systems. This style is ignored on earlier Windows NT systems, and on Windows 95 and Windows 98.

禁用Windows 2000系统上的tooltip淡入淡出动画。这种风格被早期版本的Windows NT系统、Windows 95和Windows98忽略。

TTS_NOPREFIX

Prevents the system from stripping ampersand characters from a string or terminating a string at a tab character. Without this style, the system automatically strips ampersand characters and terminates a string at the first tab character. This allows an application to use the same string as both a menu item and as text in a tooltip control.

防止系统将&符号从一个字符串去除,或终止于一个制表符的字符串。没有这种风格,系统会自动去除&符号,并且终止于第一个制表符的字符串。这允许应用程序使用同一个字符串作为一个菜单项和一个tooltip控件的文本。

TTS_USEVISUALSTYLE

Uses themed hyperlinks. The theme will define the styles for any links in the tooltip. This style always requires TTF_PARSELINKS to be set.

使用主题的超链接。主题将在tooltip中为任何链接定义风格。这种风格总是需要设置TTF_PARSELINKS。

Remarks

A tooltip control always has the WS_POPUP and WS_EX_TOOLWINDOW window styles, regardless of whether you specify them when creating the control.

一个tooltip控件始终有WS_POPUP和WS_EX_TOOLWINDOW窗口样式,不管你创建控件时是否指定。


NMTTCUSTOMDRAW Structure

typedef struct tagNMTTCUSTOMDRAW { 
  NMCUSTOMDRAW nmcd;        //包含自定义绘制的信息 
  UINT         uDrawFlags;    //指定ToolTip文本显示时,将如何被格式化 
} NMTTCUSTOMDRAW, *LPNMTTCUSTOMDRAW; 
NMTTDISPINFO Structure

typedef struct { 
  NMHDR     hdr;    //NMHDR结构,它包含有关通知的其他信息 
  LPTSTR    lpszText;    //作为ToolTip文本显示的一个空终止符字符串指针 
  TCHAR     szText;    //缓冲区接收ToolTip文本 
  HINSTANCE hinst;    //实例,此实例包含ToolTip文本使用的字符串资源 
  UINT      uFlags;    //标志,指示如何解释包含的NMHDR结构的idFrom成员 
#if (_WIN32_IE >= 0x0300
  LPARAM    lParam;    //应用程序定义的数据与该工具关联 
#endif  
} NMTTDISPINFO, *LPNMTTDISPINFO; 
TOOLINFO Structure

typedef struct { 
  UINT      cbSize;    //这个结构的大小,以字节为单位。这名成员必须指定 
  UINT      uFlags;    //控制tooltip显示的标志 
  HWND      hwnd;    //包含工具的窗口的句柄 
  UINT_PTR  uId;    //应用程序定义这个工具的标识符 
  RECT      rect;    //工具的矩形边界坐标 
  HINSTANCE hinst;    //实例,此实例包含ToolTip文本使用的字符串资源 
  LPTSTR    lpszText;    //缓冲区的指针,包含工具显示文本,或包含文本的字符串资源标识符 
#if (_WIN32_IE >= 0x0300
  LPARAM    lParam;    //Version 4.70及以上。一个32位应用程序定义的值,与该工具关联 
#endif  
#if (_WIN32_WINNT >= Ox0501) 
  void      *lpReserved;//Windows XP and later. 保留。必须设置为NULL 
#endif  
} TOOLINFO, *PTOOLINFO, *LPTOOLINFO; 
uFlags标志可取下面值:

ValueMeaning
TTF_ABSOLUTE

. Positions the tooltip window at the same coordinates provided by. This flag must be used with the TTF_TRACK flag.

tooltip窗口的位置与TTM_TRACKPOSITION提供的坐标相同此标志必须TTF_TRACK标志使用

TTF_CENTERTIP

Centers the tooltip window below the tool specified by the uId member.

tooltip窗口在uId成员指定的工具的中心。

TTF_IDISHWND

Indicates that the uId member is the window handle to the tool. If this flag is not set,uId is the tool's identifier.

表示uId成员是工具的窗口句柄如果没有设置这个标志uid是该工具的标识符

TTF_PARSELINKS

. Indicates that links in the tooltip text should be parsed.

Note that Comctl32.dll version 6 is not redistributable but it is included in Windows XP or later. To use Comctl32.dll version 6, specify it in a manifest. For more information on manifests, see.

表示解析tooltip文本链接

TTF_RTLREADING

Indicates that the tooltip text will be displayed in the opposite direction to the text in the parent window.

表示tooltip文本将在相反的方向显示在父窗口文本

TTF_SUBCLASS

Indicates that the tooltip control should subclass the tool's window to intercept messages, such as. If this flag is not set, you must use the message to forward messages to the tooltip control. For a list of messages that a tooltip control processes, see TTM_RELAYEVENT.

表示tooltip控件应该子类化工具的窗口进行拦截消息,WM_MOUSEMOVE如果没有设置这个标志,你必须使用TTM_RELAYEVENT的消息,将此消息发送到tooltip控件。让tooltip控件处理一个消息列表时,看到TTM_RELAYEVENT。

TTF_TRACK

. Positions the tooltip window next to the tool to which it corresponds and moves the window according to coordinates supplied by the messages. You must activate this type of tool using the message.

tooltip窗口旁边的工具,它根据的TTM_TRACKPOSITION消息提供的坐标来对应和移动窗口位置你必须使用TTM_TRACKACTIVATE消息激活此类型工具

TTF_TRANSPARENT

. Causes the tooltip control to forward mouse event messages to the parent window. This is limited to mouse events that occur within the bounds of the tooltip window.

引起tooltip控件发送鼠标事件消息到父窗口这是有限的鼠标事件,此鼠标事件是发生在tooltip窗口范围

 TTGETTITLE Structure

typedef struct { 
  DWORD dwSize;        //指定结构的大小 
  UINT  uTitleBitmap;    //指定tooltip图标 
  UINT  cch;        //指定标题的字符数 
  WCHAR *pszTitle;    //指向包含标题的一个宽字符串的指针 
} TTGETTITLE, *PTTGETTITLE; 
TTHITTESTINFO Structure

typedef struct _TT_HITTESTINFO { 
  HWND     hwnd;    //工具或指定工具窗口的句柄 
  POINT    pt;        //测试的客户坐标点 
  TOOLINFO ti;        //如果pt点在hwnd所指定的工具上,获取工具信息 
} TTHITTESTINFO, *LPHITTESTINFO; 

参考资料:

阅读(1059) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~