我想获取当前演示文稿的所有PowerPoint幻灯片,并将它们与图片框一起添加到我的表格布局面板中,但我的图片框由于某种原因不会显示。
public partial class PPT_GUI : Form
{
public PPT_GUI(PowerPoint.Slides Sld)
{
InitializeComponent();
int rowCount = 1;
PictureBox[] Box;
Box = new PictureBox[Sld.Count];
for (int i = 0; i < Sld.Count; i++)
{
Sld[i+1].Copy();
Box[i] = new PictureBox();
Box[i].Width = 90;
Box[i].Height = 90;
Box[i].SizeMode = PictureBoxSizeMode.StretchImage;
Box[i].BorderStyle = BorderStyle.FixedSingle;
Box[i].BringToFront();
tableLayoutPanel1.Controls.Add(Box[i], i%3, rowCount );
if (i % 3 == 0)
{
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 360F));
rowCount++;
}
if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap))
{
ImageSource imgSource = BinaryStructConverter.ImageFromClipboardDib();
Box[i].Image = ImageWpfToGDI(imgSource);
}
}
}
}