A: Note: the DisplayRect property is modified when the avi file is opened. Therefore, setting or getting the DisplayRect must be done after the file is opened.
begin
with MediaPlayer1 do begin
DeviceType := dtAutoSelect;
visible := false;
FileName := InputBox('AVI', 'Enter AVI file name',
'c:\windows\borland.avi');
display := panel1;
open;
DisplayRect := rect(0, 0, panel1.width, panel1.height);
{This is it!}
rewind;
play;
end;
end;