用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
1.7 KiB

5 months ago
#include "stdafx.h"
#include "TipWnd.h"
#define TIMER_END_TIP 100
namespace SOUI{
static SStringT s_TipLayout;
STipWnd::STipWnd(const SStringT & strLayout) :SHostWnd(strLayout)
{
}
STipWnd::~STipWnd()
{
}
void STipWnd::OnFinalMessage(HWND hWnd)
{
__super::OnFinalMessage(hWnd);
delete this;
}
void STipWnd::SetTip(const SStringT & strTip)
{
SWindow *pText = FindChildByName(L"txt_tip");
pText->SetWindowText(strTip);
}
void STipWnd::SetLayout(LPCTSTR pszLayout)
{
s_TipLayout = pszLayout;
}
void STipWnd::ShowTip(int x, int y, AnchorType at, const SStringT & strTip)
{
STipWnd *pTipWnd = new STipWnd(s_TipLayout);
pTipWnd->m_ptAnchor.x = x;
pTipWnd->m_ptAnchor.y = y;
pTipWnd->m_anchorType = at;
pTipWnd->Create(NULL);
pTipWnd->SetTip(strTip);
pTipWnd->SetWindowPos(HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE|SWP_SHOWWINDOW);
pTipWnd->SetTimer(TIMER_END_TIP, 3000);
}
void STipWnd::OnWindowPosChanging(LPWINDOWPOS lpWndPos)
{
if ( !(lpWndPos->flags&SWP_NOSIZE))
{//<EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>С<EFBFBD>ı䣬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>anchor<EFBFBD>ƶ<EFBFBD>λ<EFBFBD><EFBFBD>
switch (m_anchorType)
{
case AT_LEFT_TOP:
lpWndPos->x = m_ptAnchor.x;
lpWndPos->y = m_ptAnchor.y;
break;
case AT_LEFT_BOTTOM:
lpWndPos->x = m_ptAnchor.x;
lpWndPos->y = m_ptAnchor.y - lpWndPos->cy;
break;
case AT_RIGHT_TOP:
lpWndPos->x = m_ptAnchor.x - lpWndPos->cx;
lpWndPos->y = m_ptAnchor.y;
break;
case AT_RIGHT_BOTTOM:
lpWndPos->x = m_ptAnchor.x - lpWndPos->cx;
lpWndPos->y = m_ptAnchor.y - lpWndPos->cy;
break;
}
lpWndPos->flags &= ~SWP_NOMOVE;
}
}
void STipWnd::OnTimer(UINT_PTR timerID)
{
SetMsgHandled(FALSE);
if (timerID == TIMER_END_TIP)
{
SNativeWnd::DestroyWindow();
}
}
}