![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Прогресс Бар в СтатусБар [D6, Win2k]
Denis_Visma © (2004-06-21 12:10:00)Уважаемые помогите! Я посмотрел по поиску, но ничего не нашел, помогите с этим разобраиться. Мне надо сделать сабж. Я конечно мог бы найти компоненты которые это позволяют, но это уже краяний метод, можно ли это сделать руцями?
Спасибо.
Denis_Visma (2004-06-21 12:32:00) [1]Спасибо. Вопрос закрыт
han_malign (2004-06-21 12:28:00) [2]
procedure DrawSimpleHProgressBar(aCanvas: TCanvas; const aRect: TRect; aColor: TColor;
aText: string; aPercent: byte; aHCenterText: boolean);
var W,H,X,Y: integer;
_rect: TRect;
_clr: TColor;
_bs: TBrushStyle;
begin
if(aPercent>100)then aPercent:=0;
W:=aRect.Right-aRect.Left+1; H:=aRect.Bottom-aRect.Top+1;
_rect:=aRect;
if(aPercent>0)then begin
_rect.Right:=aRect.Left+W*aPercent div 100-1;
_clr:=aCanvas.Brush.Color;
aCanvas.Brush.Color:=aColor;
aCanvas.FillRect(_rect);
aCanvas.Brush.Color:=_clr;
aText:=aText+' '+IntStr(aPercent)+'%';
_rect.Left:=_rect.Right+1;
_rect.Right:=aRect.Right;
end;
if(_rect.Right>=_rect.Left)then aCanvas.FillRect(_rect);
Y:=(H-aCanvas.TextHeight(aText))div 2;
if(Y<0)then Y:=0;
X:=(W-aCanvas.TextWidth(aText))div 2;
if(X<0)then X:=0;
if((X>Y)and not aHCenterText)then
if(Y>0)then X:=Y
else if(X>2)then X:=2;
_bs:=aCanvas.Brush.Style;
aCanvas.Brush.Style:=bsClear;
aCanvas.TextOut(aRect.Left+X,aRect.Top+Y,aText);
aCanvas.Brush.Style:=_bs;
end;
serge (2004-06-21 12:26:00) [3]Left and Top properties are relative to StatusBar component.
Denis_Visma (2004-06-21 12:24:00) [4]а можно примерчик рабочего кода...я делаю как выше было сказано, так прогресс ьар пропадает...
Думкин (2004-06-21 12:17:00) [5]
> [3] Denis_Visma (21.06.04 12:16)
У него описано сие в книге про компоненты.
Denis_Visma (2004-06-21 12:16:00) [6]в смысле?
Думкин (2004-06-21 12:12:00) [7]Рэй Конопка.
serge (2004-06-21 12:11:00) [8]ProgressBar1.Parent:=StatusBar1;
ProgressBar1.LEft:=...; ProgressBar1.Top:=...;