Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
Delphi 6 Personal
|
Re: 'Visualissation'
20. Jun 2005, 19:17
Ein Beispiel:
Delphi-Quellcode:
// Diese Methode flackert, weil erst der Hintergrund gelöscht wird
// und danach gezeichnet.
procedure TForm1.Timer1Timer(Sender: TObject);
var
p: integer;
aRect: TRect;
begin
// Bar's zeichnen / aktualisieren
if BassDLLPlayer1.Status = sndPlaying then
begin
aRect := PaintBox1.ClientRect;
// Hintergrund der PaintBox Löschen
PaintBox1.Canvas.Brush.Color := clBlack;
PaintBox1.Canvas.Brush.Style := bsSolid;
PaintBox1.Canvas.FillRect(aRect);
//--- Obere Hälfte - LeftPeak ---------------------------------
aRect.Bottom := (aRect.Bottom div 2) - 1; //Obere Hälfte der PaintBox
// Ein bischen Prozentrechnung
p := trunc((BassDLLPlayer1.LeftPeak / MaxPeak) * 100);
aRect.Right := trunc((p * aRect.Right) / 100);
PaintBox1.Canvas.Brush.Color := clRed;
PaintBox1.Canvas.FillRect(aRect);
//--- Untere Hälfte - RightPeak -------------------------------
aRect.Right := TmpRight; // <----<<< diese Zeile fehlte noch <----<<<
aRect.Top := aRect.Bottom + 3; //Untere Hälfte der PaintBox 3 Px Abstand
aRect.Bottom := aRect.Bottom * 2 + 3;
// Ein bischen Prozentrechnung
p := trunc((BassDLLPlayer1.RightPeak / MaxPeak) * 100);
aRect.Right := trunc((p * aRect.Right) / 100);
PaintBox1.Canvas.Brush.Color := clRed;
PaintBox1.Canvas.FillRect(aRect);
end;
end;
|
|
Zitat
|