首页 > 解决方案 > 如何在 Windows 窗体 C# 中的 MouseDown 上启动声音播放器

问题描述

当我触发soundPlayer.Play();按钮的单击事件时,它仅在您取消单击按钮后播放。我试图在 MouseDown 上触发它

private void Button_MouseDown(object sender, EventArgs e)
{
    soundPlayer.Play();
}

但这并没有做任何事情。我怎样才能让它工作?

编辑:我想通了,我通过进入属性下的事件并使用 MouseDown 事件来做到这一点

标签: c#winforms

解决方案


推荐阅读