使⽤Spire.Prentation第三⽅把PPT转换成图⽚播放using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Spire.Prentation;
using System.Runtime.InteropServices;
using Spire.Prentation.Drawing.Transition;
using Spire.Prentation.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
冰山英文{
private List<Image> lst = new List<Image>();
//获取当前幻灯⽚页码
private int ImageIndex = 0;
private Timer timer1 = new Timer();
// 幻灯⽚的数量
int slidescount;
//⽂件夹地址
string stythFile = @"C:\TASHCurrPathImg";
//图⽚地址
string stythFileimg = @"C:\TASHCurrPathImg\";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object nder, EventArgs e)
{
pathing();//创建存储⽂件夹
string sthy = Qik();//获取ppt地址
Prentation ppt = new Prentation();
ppt.LoadFromFile(sthy);//读取ppt
slidescount = ppt.Slides.Count;
try
{
狗咬尾巴if (slidescount > 0)
{
for (int i = 0; i < slidescount; i++)
{
ppt.Slides[i].SaveAsEMF(stythFileimg + i + ".emf");//把ppt转换成emf格式图⽚
Image image = Bitmap.FromFile(stythFileimg + i + ".emf");//读取emf格式图⽚
image.Save(stythFileimg + i + ".Png", ImageFormat.Png);//把emf格式的图⽚转换成Png格式
}
}
}
catch (Exception ex)
catch (Exception ex)
{
}
for (int i = 0; i < slidescount; i++)
{
lst.Add(Image.FromFile(stythFileimg + i + ".Png")); }
pictureBox1.Image = lst[0];
}
public static string Qik()
{
//选择⽂件夹
OpenFileDialog fileDialog = new OpenFileDialog();
fileDialog.Multilect = true;
fileDialog.Title = "请选择⽂件";
fileDialog.Filter = "所有⽂件(*.*)|*.*";
if (fileDialog.ShowDialog() == DialogResult.OK)
{
string fly= fileDialog.FileName;
return fly;
}
return "";
}
全景天窗的优缺点
/// <summary>
///
/
// </summary>
/// <param name="nder"></param>
/// <param name="e"></param>
private void button3_Click(object nder, EventArgs e) {
if (ImageIndex>0)
{
ImageIndex--;
pictureBox1.Image = lst[ImageIndex];
}
}
/// <summary>
/
// 下⼀页
/// </summary>
/// <param name="nder"></param>
/// <param name="e"></param>
private void button4_Click(object nder, EventArgs e) {
if (ImageIndex+1<slidescount)
{
ImageIndex++;
pictureBox1.Image = lst[ImageIndex];
}
el
{
MessageBox.Show("已经到底了");
}
}
/// <summary>
/// 关闭
/// 关闭
平行线的判定定理
/// </summary>
/// <param name="nder"></param>
三角枫/// <param name="e"></param>
private void button2_Click(object nder, EventArgs e)
{
this.Dispo();
红疹是怎么引起的this.Clo();
}
/// <summary>
/// 创建⽂件夹
/// </summary>
public void pathing()
{
try
{
if (fal == System.IO.Directory.Exists(stythFile))//判断是否重复
{
//创建⽂件夹
System.IO.Directory.CreateDirectory(stythFile);
}
}
catch (Exception ex)
{
}
}
public void pathingDelect()
{
if (System.IO.Directory.Exists(stythFile) == true)
{
foreach (string f in System.IO.Directory.GetFileSystemEntries(stythFile)) {
if (File.Exists(f))
{
//如果有⼦⽂件删除⽂件
File.Delete(f);
Console.WriteLine(f);
}
我仍然坚持}
System.IO.Directory.Delete(stythFile);
}
}
三年级美术
}
}