T,&info);
}
else
{
CWnd::ShowScrollBar(SB_VERT,FALSE);
}
}
CPaintDC dc(this); // device context for painting
file://dc.FillSolidRect(0,0,rect.Width(),rect.Height(),RGB(255,255,255));
dc.Rectangle(0,0,rect.Width(),rect.Height());
logFont.lfWidth = 1;
dc.SelectObject(pFont);
int m_nBeginShow = CWnd::GetScrollPos(SB_VERT);
for(int i=m_nBeginShow;i<m_aInfo.GetSize() && logFont.lfWidth < rect.Height() - 2;i++)
{
if(i == m_nMousePos)
{
dc.SetBkColor(RGB(0,0,128));
dc.FillSolidRect(1,logFont.lfWidth,rect.Width() - 2,logFont.lfHeight,RGB(0,0,128));
dc.SetTextColor(RGB(255,255,255));
}
else
{
dc.SetBkColor(RGB(255,255,255));
dc.SetTextColor(RGB(0,0,0));
}
dc.TextOut(3,logFont.lfWidth,m_aInfo[i].strDepict);
logFont.lfWidth += logFont.lfHeight;
}
}
void CWndForACComboBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
}
void CWndForACComboBox::OnLButtonUp(UINT nFlags, CPoint point)
{
CFont * pFont;
LOGFONT logFont;
if(m_pComboBox)
{
pFont = m_pComboBox->GetParent()->GetFont();
pFont->GetLogFont(&logFont);
if(logFont.lfHeight < 0) logFont.lfHeight = -logFont.lfHeight;
m_nMousePos = (point.y - 1) / logFont.lfHeight + CWnd::GetScrollPos(SB_VERT);
if(m_nMousePos >= 0 && m_nMousePos < m_aInfo.GetSize())
m_pComboBox->SetCurSel(m_aInfo[m_nMousePos].nid);
ShowWindow(SW_HIDE);
}
CWnd::OnLButtonUp(nFlags, point);
}
BOOL CWndForACComboBox::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
// TODO: Add your message handler code here and/or call default
return CWnd::OnMouseWheel(nFlags, zDelta, pt);
}
void CWndForACComboBox::OnKillFocus(CWnd* pNewWnd)
{
CWnd::OnKillFocus(pNewWnd);
if(pNewWnd->GetSafeHwnd() != m_pComboBox->GetSafeHwnd() && pNewWnd->GetSafeHwnd() != GetSafeHwnd() && IsWindow(GetSafeHwnd()))
ShowWindow(SW_HIDE);
}
void CWndForACComboBox::OnMouseMove(UINT nFlags, CPoint point)
{
CFont * pFont;
LOGFONT logFont;
::ShowCursor(TRUE);
if(m_pComboBox)
{
pFont = m_pComboBox->GetParent()->GetFont();
pFont->GetLogFont(&logFont);
if(logFont.lfHeight < 0) logFont.lfHeight = -logFont.lfHeight;
logFont.lfWidth = point.y / logFont.lfHeight + CWnd::GetScrollPos(SB_VERT);
if(logFont.lfWidth != m_nMousePos)
{
m_nMousePos = logFont.lfWidth;
Invalidate();
}
}
CWnd::OnMouseMove(nFlags, point);
}
void CWndForACComboBox::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if(m_aInfo.GetSize() <= 0)
{
&