我正在开发一个WinForm应用程序.我想在用户点击按钮时播放MP3文件.
MP3文件位于执行应用程序的计算机的文件系统中.
我用谷歌搜索了一段时间,我找到了有关System.Media.SoundPlayer课程的信息.但我已经读过SoundPlayer该类只能用于播放.wav格式的文件.
可以使用哪些类来播放.mp3格式的文件?
任何帮助将不胜感激.
我开发了一个WPF示例项目.
这是主窗口的XAML标记:
<Window x:Class="ToolTipSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
WindowState="Maximized">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button Click="OnButtonClick">Show ToolTip</Button>
<StatusBar Grid.Row="2">
<StatusBarItem>
<TextBlock Text="TextBlock With ToolTip">
<TextBlock.ToolTip>
<ToolTip x:Name="m_toolTip">
ToolTip
</ToolTip>
</TextBlock.ToolTip>
</TextBlock>
</StatusBarItem>
</StatusBar>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
这是没有using语句的主窗口代码隐藏:
namespace ToolTipSample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void OnButtonClick(object p_sender, RoutedEventArgs p_args)
{
m_toolTip.IsOpen = true;
}
} …Run Code Online (Sandbox Code Playgroud) 我正在开发一个WPF应用程序.
主窗口的子控件包含在网格中.
底行包含状态栏.
应用程序必须通知用户.
我想以编程方式在主窗口右下角的用户控件中显示通知.
我希望通知用户控件显示在状态栏和上一行中的控件上.
如何显示对网格中包含的其他控件的控件?
任何帮助将不胜感激
我正在开发一个完整的Web应用程序,我正在使用ASP.NET MVC 3框架.我正在实现一个子类ActionFilterAttribute.
我压倒了这个OnActionExecuting方法.如果在OnActionExecuting方法中捕获到异常,我想重定向客户端浏览器.重定向URL以我的一个控制器中的操作方法为目标.我想将数据从Exception对象传递到重定向URL.
有没有办法构建包含该Exception对象的URL,然后将URL传递给RedirectResult构造函数?
我是PowerShell脚本的初学者.
我试图通过执行以下命令来创建.Net对象,但它失败了:
[System.Collections.Generic.List<System.String>]$myList = New-Object System.Collections.Generic.List<System.String>
Run Code Online (Sandbox Code Playgroud)
错误消息通知我尚未找到类型[System.Collections.Generic.List].
错误消息还告诉我我应该检查是否加载了包含该类型的程序集.
我想我必须加载包含[System.Collections.Generic.List]类型的程序集,但我不知道该怎么做.
我也想知道我在哪个.Net框架版本中可以使用PowerShell中的类型.
任何帮助将不胜感激
我开发了一个示例WPF项目.
这是主窗口的代码隐藏:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
namespace MainWindowInBackground
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Window l_hostWindow = new Window()
{
Owner = System.Windows.Application.Current.MainWindow,
WindowStartupLocation = WindowStartupLocation.CenterOwner,
Content = "Test"
};
l_hostWindow.Show(); …Run Code Online (Sandbox Code Playgroud) 我使用<p>标记创建了一个HTML段落.段落块的尺寸为:
如果我插入一长串连续的字符,我想要显示一个水平滚动条.我试图设置CSS溢出属性,但我的字符行被破坏,其余字符显示在一个新行上.
如何显示水平滚动条而不是打破长行字符?