C# 在WPF中的框架中显示Powerpoint演示文稿
我试图实现的是直接显示PowerPoint演示文稿,而无需在WPF窗口中打开PowerPoint。 现在,我使用以下代码开始演示:C# 在WPF中的框架中显示Powerpoint演示文稿,c#,wpf,overlay,powerpoint,C#,Wpf,Overlay,Powerpoint,我试图实现的是直接显示PowerPoint演示文稿,而无需在WPF窗口中打开PowerPoint。 现在,我使用以下代码开始演示: Process proc = new Process(); proc.StartInfo.FileName = @"C:\Program Files (x86)\Microsoft Office\Office14\POWERPNT.EXE"; proc.StartInfo.Arguments = " /s " + source.ToStrin
Process proc = new Process();
proc.StartInfo.FileName = @"C:\Program Files (x86)\Microsoft Office\Office14\POWERPNT.EXE";
proc.StartInfo.Arguments = " /s " + source.ToString();
proc.Start();
变量源是所需文件的路径。
这段代码以全屏方式打开PowerPoint演示文稿,这很好,但我的应用程序运行在没有连接键盘或鼠标的触摸设备上。因此,我希望能够在演示文稿上方放置一个覆盖层,例如“关闭”按钮
我已经找到了这个话题
,但我很难理解那里到底发生了什么
我希望有人能帮助我
提前谢谢。我设法用一种我能接受的方式做了这件事。 代码如下: XAML: 这可能有助于:
<Window x:Name="window" x:Class="Project.PowerPointViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Project"
mc:Ignorable="d"
Title="PowerPointViewer" Background="Transparent" Topmost="True" AllowsTransparency="True" ResizeMode="NoResize" WindowStyle="None" WindowState="Maximized">
public partial class PowerPointViewer : Window
{
Process proc = new Process();
Window main;
public PowerPointViewer(Window main)
{
InitializeComponent();
this.main = main;
}
public void open(string source)
{
proc.StartInfo.FileName = @"C:\Program Files (x86)\Microsoft Office\Office14\POWERPNT.EXE";
proc.StartInfo.Arguments = " /s " + source;
proc.Start();
Show();
}
private void bt_close_Click(object sender, RoutedEventArgs e)
{
if (!proc.HasExited)
proc.Kill();
Close();
main.Focus();
}
}