logo search
Учебник_ПОА

To add the Windows Media Player control to a Windows Form

  1. Drag the Windows Media Player control from the Toolbox to the Windows Form.

  2. In the Properties window, set the Dock property to Fill. You can do this by clicking the center square.

  3. Double-click the title bar of the form to add the default Load event in the Code Editor.

  4. Add the following code to the Form_Load event handler to load a video when the application opens.

    Note:

    The path used is a forward link that points to an on-line video. You can change the path and file name to display a different video.

    axWindowsMediaPlayer1.URL =

    @"http://go.microsoft.com/fwlink/?LinkId=95772";

  5. This code sets the URL of the Windows Media Player to the media file that you have specified. Windows Media Player will automatically start to play when you set the URL property because the autoStart property is true by default.

  6. Press F5 to run the code.

  7. When the application opens, change the size of the form to full-screen by double-clicking the title bar of the form.