|
// SDlg.cpp: implementation of the SDlg class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SBitDialog.h"
#include "SDlg.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
SDlg::SDlg()
{
}
SDlg::~SDlg()
{
}
BEGIN_MESSAGE_MAP(SDlg, CButton)
ON_WM_MOUSEMOVE()
ON_WM_KEYDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void SDlg::SetToolTipText(CString s)
{
if(m_tooltip.m_hWnd==NULL)
{
if(m_tooltip.Create(this)) //first assignment
if(m_tooltip.AddTool(this, (LPCTSTR)s))
m_tooltip.Activate(1);
}
else {
m_tooltip.UpdateTipText((LPCTSTR)s,this);
}
}
void SDlg::RelayEvent(UINT message, WPARAM wParam, LPARAM lParam)
{
// This function will create a MSG structure, fill it in a pass it to
// the ToolTip control, m_ttip. Note that we ensure the point is in window
// coordinates (relative to the control's window).
if(NULL != m_tooltip.m_hWnd){
MSG msg;
msg.hwnd = m_hWnd;
msg.message = message;
msg.wParam = wParam;
msg.lParam = lParam;
msg.time = 0;
msg.pt.x = LOWORD(lParam);
msg.pt.y = HIWORD(lParam);
m_tooltip.RelayEvent(&msg);
}
}
void SDlg::OnMouseMove(UINT nFlags, CPoint point)
{
RelayEvent(WM_MOUSEMOVE,(WPARAM)nFlags,MAKELPARAM(LOWORD(point.x),LOWORD(point.y)));
CButton::OnMouseMove(nFlags, point);
}
bool SDlg::MakeButton(CString st,UINT Resource, UINT ResourceSel, UINT ResourceFocus, UINT ResourceDisabled)
{
LoadBitmaps(Resource,ResourceSel,ResourceFocus,ResourceDisabled);
SetToolTipText(st);
SizeToContent();
return true;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This is Saday Chand Sarkar , New in MFC world.
Working in Trek Technology Pte.Ltd.