i found on amule source a bether method for ProgressBar:
case5:// progress{if(thePrefs::ShowProgBar()){intiWidth=rect.GetWidth()-2;intiHeight=rect.GetHeight()-2;// DO NOT DRAW IT ALL THE TIMEuint32dwTicks=GetTickCount();wxMemoryDCcdcStatus;if(item->dwUpdated<dwTicks||!item->status||iWidth!=item->status->GetWidth()){if(item->status==NULL){item->status=newwxBitmap(iWidth,iHeight);}elseif(item->status->GetWidth()!=iWidth){// Only recreate if the size has changeditem->status->Create(iWidth,iHeight);}cdcStatus.SelectObject(*item->status);if(thePrefs::UseFlatBar()){DrawFileStatusBar(file,&cdcStatus,wxRect(0,0,iWidth,iHeight),true);}else{DrawFileStatusBar(file,&cdcStatus,wxRect(1,1,iWidth-2,iHeight-2),false);// Draw black bordercdcStatus.SetPen(*wxBLACK_PEN);cdcStatus.SetBrush(*wxTRANSPARENT_BRUSH);cdcStatus.DrawRectangle(0,0,iWidth,iHeight);}item->dwUpdated=dwTicks+5000;// Plus five seconds}else{cdcStatus.SelectObject(*item->status);}dc->Blit(rect.GetX(),rect.GetY()+1,iWidth,iHeight,&cdcStatus,0,0);}if(thePrefs::ShowPercent()){// Percentage of completing// We strip anything below the first decimal point,// to avoid Format doing roundingsfloatpercent=floor(file->GetPercentCompleted()*10.0f)/10.0f;wxStringbuffer=wxString::Format(wxT("%.1f%%"),percent);intmiddlex=(2*rect.GetX()+rect.GetWidth())>>1;intmiddley=(2*rect.GetY()+rect.GetHeight())>>1;wxCoordtextwidth,textheight;dc->GetTextExtent(buffer,&textwidth,&textheight);wxColourAktColor=dc->GetTextForeground();if(thePrefs::ShowProgBar()){dc->SetTextForeground(*wxWHITE);}else{dc->SetTextForeground(*wxBLACK);}dc->DrawText(buffer,middlex-(textwidth>>1),middley-(textheight>>1));dc->SetTextForeground(AktColor);}}break;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: NO
i found on amule source a bether method for ProgressBar: