AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Videogrösse an Panel anpassen
Thema durchsuchen
Ansicht
Themen-Optionen

Videogrösse an Panel anpassen

Ein Thema von Christian18 · begonnen am 12. Feb 2005 · letzter Beitrag vom 12. Feb 2005
 
jensw_2000
(Gast)

n/a Beiträge
 
#2

Re: Videogrösse an Panel anpassen

  Alt 12. Feb 2005, 11:39
Habe das hier mal in der DP gefunden ...
Leider kann ich den Beitrag jetzt nicht mehr finden ... aber es funktioniert super ...

Delphi-Quellcode:
function GetRect(Panel: TPanel): TRect;
var Width, Height: Integer; newWidth, newHeight: Single; T: Integer;
begin
  Result := Panel.ClientRect;
  if not GetSizeInfo(frmDetails.MediaPlayer.FileName, Width, Height) then exit;
  newWidth := (Width * (Result.Bottom - Result.Top)) / Height;
  newHeight := (Height * (Result.Right - Result.Left)) / Width;
  if (newWidth < (Result.Right - Result.Left)) and
     (newHeight > (Result.Bottom - Result.Top)) then
  begin
    T := Round((Result.Right - Result.Left - newWidth) / 2);
    Inc(Result.Left, T);
    Dec(Result.Right, 2*T);
  end
  else if (newHeight < (Result.Bottom - Result.Top)) and
          (newWidth > (Result.Right - Result.Left)) then
  begin
    T := Round((Result.Bottom - Result.Top - newHeight) / 2);
    Inc(Result.Top, T);
    Dec(Result.Bottom, 2*T);
  end
end;
Delphi-Quellcode:
// Größe des Videos auslesen
function GetSizeInfo(Name: string; var Width, Height: Integer): Boolean;
var dwParam2: TMCI_OVLY_RECT_PARMS;
    Retval: longint;
begin
  Result := false;
  dwParam2.dwCallback := MediaPlayer.Handle;
  dwParam2.rc.Left := 0;
  dwParam2.rc.Top := 0;
  dwParam2.rc.Right := 0;
  dwParam2.rc.Bottom := 0;
  Retval := mciSendCommand(MediaPlayer.DeviceID,MCI_WHERE, MCI_OVLY_WHERE_SOURCE, integer(@dwParam2));
  if Retval <> 0 then exit;
  Width := dwParam2.rc.Right - dwParam2.rc.Left;
  Height := dwParam2.rc.Bottom - dwParam2.rc.Top;
  Result := true;
end;
Aufruf mit

Delphi-Quellcode:
      
      Mediaplayer.FileName:=...videofile...;
      MediaPlayer.Open;
      Mediaplayer.DisplayRect:=getRect(VideoPanel);
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz