Thema: Delphi 'Visualissation'

Einzelnen Beitrag anzeigen

Benutzerbild von turboPASCAL
turboPASCAL

Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
 
Delphi 6 Personal
 
#21

Re: 'Visualissation'

  Alt 20. Jun 2005, 18: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;
Matti
Meine Software-Projekte - Homepage - Grüße vom Rüsselmops -Mops Mopser
  Mit Zitat antworten Zitat