This site is for P2P development and test software ONLY!

Client Percentage in Download List

search:

void CDownloadListCtrl::DrawFileItem

add under:

CString buffer;


search:


RECT rec_status;
rec_status.left = 0;
rec_status.top = 0;
rec_status.bottom = iHeight;
rec_status.right = iWidth;
pClient->DrawStatusBar(&cdcStatus, &rec_status,(pCtrlItem->type == UNAVAILABLE_SOURCE), thePrefs.UseFlatBar());

add under:

//b4 Client percentage Start
if (pClient->GetPartStatus() && pCtrlItem->type == AVAILABLE_SOURCE)
{
float percent = (float)pClient->GetAvailablePartCount() / (float)pClient->GetPartCount()* 100.0f;
if (percent > 0.05f)
{

COLORREF oldclr = cdcStatus.SetTextColor(RGB(0,0,0));
int iOMode = cdcStatus.SetBkMode(TRANSPARENT);
buffer.Format(_T("%.1f%%"), percent);
CFont *pOldFont = cdcStatus.SelectObject(&m_fontBold);
#define DrawClientPercentText cdcStatus.DrawText(buffer, buffer.GetLength(),&rec_status, ((DLC_DT_TEXT | DT_RIGHT) & ~DT_LEFT) | DT_CENTER)
rec_status.top-=1;rec_status.bottom-=1;
DrawClientPercentText;rec_status.left+=1;rec_status.right+=1;
DrawClientPercentText;rec_status.left+=1;rec_status.right+=1;
DrawClientPercentText;rec_status.top+=1;rec_status.bottom+=1;
DrawClientPercentText;rec_status.top+=1;rec_status.bottom+=1;
DrawClientPercentText;rec_status.left-=1;rec_status.right-=1;
DrawClientPercentText;rec_status.left-=1;rec_status.right-=1;
DrawClientPercentText;rec_status.top-=1;rec_status.bottom-=1;
DrawClientPercentText;rec_status.left++;rec_status.right++;
cdcStatus.SetTextColor(RGB(255,255,255));
DrawClientPercentText;
cdcStatus.SelectObject(pOldFont);
cdcStatus.SetBkMode(iOMode);
cdcStatus.SetTextColor(oldclr);

}
}
//b4 Client percentage End

0 comments:

发表评论