{$apptype windows}
{$reference 'System.Windows.Forms.dll'}
{$reference 'System.dll'}
{$reference 'PresentationCore.dll'}
uses System.Windows.Forms,
System.Windows.Media,
System;
var myForm: Form;
var myButton:Button;
var mp:MediaPlayer;
var baseUri:Uri;
var FileDialog: openFileDialog;
procedure OnClick(sender: object; e: System.EventArgs);
begin
FileDialog := new OpenFileDialog();
FileDialog.ShowDialog();
baseUri := new Uri(FileDialog.FileName,UriKind.Relative);
mp := new MediaPlayer();
mp.Open(baseUri);
mp.Play();
end;
begin
myForm := new Form;
myForm.Width := 250;
myForm.Height:= 250;
myForm.Text := 'Форма';
myButton := new Button;
myButton.Text := 'go';
myButton.Top := myButton.Width;
myButton.left :=myButton.Width;
myButton.Click += OnClick;
myForm.Controls.Add(myButton);
Application.Run(myForm);
end.
|