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

📄 datatip.shtml

📁 mfc资源大全包含MFC编程各个方面的源码
💻 SHTML
字号:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Zafir Anjum">
   <TITLE>Controls - DataTip</TITLE>
</HEAD>
<body background="../fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink="#8E2323" alink="#FF0000">
<table WIDTH="100%">
<tr WIDTH="100%">
<td align=center><!--#exec cgi="/cgi/ads.cgi"--><td>
</tr>
</table>


<CENTER><H3><FONT COLOR="#AOAO99">DataTip</FONT></H3></CENTER>
<HR>




This article was contributed by <A HREF="mailto:simon@techsoft.demon.co.uk">Simon Wilson</A>.


<P>This class shows how I went about implementing my own tooltip window when I
had trouble getting the standard Tooltips to provide the functionality I
wanted. The attached code readily demonstrates the concepts of defining your
own windows for use with MFC, installing keyboard hooks, and handling the
correct clean-up of the system on completion (note the static methods and
instance counting). The windows use the same colour scheme as Tooltips under
Win95/NT (COLOR_INFOBK + COLOR_INFOTEXT) but you can choose your own colours
should you wish (see the OnPaint method).

<P>The class uses the standard two-stage MFC creation process. You use the
class by defining an instance of the class in your view/dialog/etc and then
calling the Create method passing it a pointer to the parent window
(normally in your OnInitialUpdate or OnInitDialog methods).

<P>You then handle the OnMouseMove event and call the Set method passing it a
display point and display string. If the mouse remains static for the
pre-defined delay time (set via SetDelay) then a tip window will be
displayed at the appropiate point. Pressing a key, pressing a mouse button,
or moving the mouse outside of a pre-defined are will remove the tip window
from the display.

<H4>Example:</H4>

<PRE><TT><FONT COLOR="#990000">
class CMyView : public CView
{
	:
	SIMDataTip m_datatip;
	:
};

void CMyView::OnInitialUpdate()
{
	CView::OnInitialUpdate();

	// enable datatips for this window

⌨️ 快捷键说明

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