Autor Beitrag
TimonWorld
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 397



BeitragVerfasst: Do 22.09.05 19:55 
Wie kann ich das Bild auf TMediaPlayer.Display stretchen?

Gruß,
Timon.
MKX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

Win XP, Ubuntu Linux 7.02
Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Mi 09.11.05 16:22 
Würde mich auch interessieren!
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 09.11.05 16:43 
ich habs damals mal so gelöst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
mediaplayer1.FileName:='mein_Film.avi';
mediaplayer1.Open;
MediaPlayer1.Display := MoviePanel;

// Die Größe des MoviePanels an den Film anpassen 
// (Das Seitenverhältnis wird dadurch festgelegt)
MoviePanel.BoundsRect := MediaPlayer1.DisplayRect;
// MoviePanel leigt auf dem MainPanel drauf.
// Das MainPanel ist die maximale Größe des Films.
// dorthinein wird das MoviePanel so gestreckt, dass es bei 
// geleichbleibendem Seitenverhältnis optimal passt.
StretchPanel(MoviePanel, MainPanel);

MediaPlayer1.DisplayRect := MoviePanel.ClientRect;
MediaPlayer1.Play;

Die Funktion StretchPanel sieht dabei so aus: Die Konstanten (-22, -4, etc.) brauchte ich bei meinem Prog, weil Teile des Panels verdeckt waren. Hab jetzt aber keine Lust, das für dich umzuschreiben ;-) Grob gesagt: Das +/- Gedöns einfach rauslöschen...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
procedure StretchPanel(var Source:TPanel; var Bounds:TPanel);
var xfactor, yfactor:double;
begin
  try
    xfactor:= (Bounds.Width-22) / Source.Width;
    yfactor:= (Bounds.Height-4) / Source.Height;
    // so weit wie möglich strecken
    if xfactor > yfactor then
    begin
      Source.Width:=round(Source.Width*yfactor);
      Source.Height:=round(Source.Height*yfactor);
      source.Top:=2;
      source.Left:=2+((Bounds.Width-22 - Source.Width) Div 2);
    end else
    begin
      Source.Width:=round(Source.Width*xfactor);
      Source.Height:=round(Source.Height*xfactor);
      source.Left:=2;
      source.Top:=2+(Bounds.Height-4 - Source.Height) Div 2;
    end;
  except
  end;
end;

_________________
We are, we were and will not be.