1

I'm trying to support the playback of multiple .wav sound files simultaneously in my WinForms application. Based on other answers I've found, using the System.Windows.Media.MediaPlayer class from the PresentationCore assembly seems to be the best way to do this.

However, when the thread creates a MediaPlayer object, the window resolution changes instantly. Here's the code that instantiates the object and plays the sound file:

MediaPlayer toneMediaPlayer = new MediaPlayer();
toneMediaPlayer.Open(new Uri(rootDirectory + @"\Sounds\" + layout.radioToneFileName));
toneMediaPlayer.Play();

My application starts up and creates the windows at normal resolution. But as soon as that code block is called, it redraws the windows at a much smaller size, with larger font. How do I prevent this from happening?

Thanks in advance for any responses!

E. Lofback
  • 61
  • 3
  • 1
    Read the notes here: [DPI Awareness - Unaware in one Release, System Aware in the Other](https://stackoverflow.com/a/50276714/7444103). – Jimi Apr 19 '19 at 08:31

0 Answers0