📄 tooltiplistbox.cpp
字号:
// ToolTipListBox.cpp : implementation file
//
#include "stdafx.h"
#include "xLANInfo.h"
#include "ToolTipListBox.h"
#include "xLANInfoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CToolTipListBox
CToolTipListBox::CToolTipListBox()
{
}
CToolTipListBox::~CToolTipListBox()
{
}
BEGIN_MESSAGE_MAP(CToolTipListBox, CListBox)
//{{AFX_MSG_MAP(CToolTipListBox)
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CToolTipListBox message handlers
void CToolTipListBox::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
int n;
CPoint ThePoint( point );
CString str;
n = SendMessage( LB_ITEMFROMPOINT,0,MAKELPARAM( ThePoint.x,ThePoint.y ) );
if( !HIWORD( n ) ) {
CToolInfo tif;
( ( CXLANInfoDlg * )GetParent() )->m_tip.GetToolInfo( tif,this );
GetText( n,str );
lstrcpy( tif.lpszText,str );
( ( CXLANInfoDlg * )GetParent() )->m_tip.SetToolInfo( &tif );
}
CListBox::OnMouseMove(nFlags, point);
}
#include "xLANInfo.h"
int CToolTipListBox::AddStringEx(LPCTSTR lpszItem)
{
// Find the longest string in the list box.
CString str;
CSize sz;
static int dx = 0;
CDC* pDC = this->GetDC();
str = lpszItem;
sz = pDC->GetTextExtent( str );
if( sz.cx > dx ) {
dx = sz.cx * LOWORD( ( ( CXLANInfoApp* )AfxGetApp() )->dwBaseUnits ) / 4;
}
ReleaseDC( pDC );
// Set the horizontal extent so every character of all strings
// can be scrolled to.
SetHorizontalExtent( dx );
return AddString( lpszItem );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -