>LineTo(rect.right,rect.top);
pDC->SelectObject(&_pen3DShadow);
pDC->MoveTo(rect.right - 1,rect.top);
pDC->LineTo(rect.right - 1,rect.bottom);
pDC->SelectObject(&_penB);
pDC->MoveTo(rect.right,rect.top + 1);
pDC->LineTo(rect.right,rect.bottom);
}
///////////调整位置//////////
rect.left += 5;
rect.right -= 2;
///////////显示图标//////////
if(rect.Width() > 16 && m_hIcon != NULL)
{
::DrawIconEx(pDC->m_hDC,rect.left,rect.top + 3,m_hIcon,16,16,0,NULL,DI_NORMAL);
rect.left += 18;
}
if (!m_sText.IsEmpty())
{
///////////显示文字//////////
rect.top += 5;
CString sText = m_sText;
int l = sText.GetLength();
int i;
for(i=0;i<10 && pDC->GetTextExtent(sText).cx > rect.Width();i++,l-=2)
sText = sText.Left(l-2);
if(i > 0)
{
sText = sText.Left(l-2);
sText += "...";
}
pDC->DrawText(sText, &rect, DT_LEFT /*| DT_VCENTER */| DT_SINGLELINE);
}
}
////调整尺寸////
void CCoolTabCtrl::AutoSize()
{
INT_PTR PageCount = m_PageList.GetCount();
if(PageCount < 1) return;
CPageItem *pItem;
POSITION pos;
CRect rect,ClientRect,ItemRect;
GetClientRect(ClientRect);
ClientRect.DeflateRect(m_nBorder+1,m_nBorder+1);
GetWindowRect(rect);
ScreenToClient(rect);
CDC* pDC = GetDC();
CFont *pOldFont = pDC->SelectObject(&m_font);
if(m_nStyle&TCS_DOWN)
{
rect.left += 6;
rect.right -= 6;
rect.bottom -= 1;
rect.top = rect.bottom - ITEMBUTTON_HEIGHT + 1;
}
else if(m_nStyle&TCS_UP)
{
rect.left += 2;
rect.right -= 6;
rect.bottom = rect.top + ITEMBUTTON_HEIGHT;
}
ItemRect = rect;
int AreaWidth = 0,
上一篇:
COOLMENU.CPP
下一篇:
2018年汽车自驾运动营地攻防箭大赛总决赛圆满落幕