-1
가능한 중복 진행 줄을 그리기 : 델파이 2010을 사용
Grid progressbar or animation
Add graphical bar to a StringGrid col이 TStringGrid의 OnDrawCell 이벤트 사용
을, 나는 5 열
ID, 시작과 함께 TStringGrid이 , End, Duration 및 각 셀에 진행률 표시 줄을 그리는 열이 있습니다.
열 5 너비 (예 : 60)는 옵션 대화 상자의 막대 너비 스핀 편집 필드에 의해 설정됩니다.
지속 시간이 (end-start) * 1440 (예 : 0.39 분)이면 전체 막대 너비의 백분율로 진행률 막대를 그려야합니다. (즉, 39/60 = 65 %) 막대를 셀 전체에 걸쳐 65 % 그려야합니다. 또한 막대 중앙에 백분율을 표시해야합니다. (네이비 블루 바 & 흰색 텍스트).
누구든지이 진행률 막대를 그릴 수 있습니까?
procedure Tphasedata.grdMainDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
LStrCell: string;
LRect: TRect;
begin
with (Sender as TStringGrid) do
begin
// Don't change color for first Column, first row
if (ACol = 0) or (ARow = 0) then
Canvas.Brush.Color := clBtnFace
else
begin
case ACol of
0: Canvas.Font.Color := clBlack;
1: Canvas.Font.Color := clBlue;
2: Canvas.Font.Color := clBlue;
3: Canvas.Font.Color := clRed;
end;
// Draw the Band
if ARow mod 2 = 0 then
Canvas.Brush.Color := $00E1FFF9
else
Canvas.Brush.Color := $00FFEBDF;
Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, cells[acol, arow]);
Canvas.FrameRect(Rect);
//center the duration text
if ACol = 3 then
begin
LStrCell := Cells[ACol, ARow]; // grab cell text
Canvas.FillRect(Rect); // clear the cell
LRect := Rect;
LRect.Top := LRect.Top + 3; // adjust top to center vertical
// draw text
DrawText(Canvas.Handle, PChar(LStrCell), Length(LStrCell), LRect, DT_CENTER);
end;
i ACol = 4 then
begin
// draw progress bar here
end;
end;
end;