Exemplo n.º 1
0
 private void button5_Click(object sender, RibbonControlEventArgs e)
 {
     if (ThisAddIn.GetAccessToken() == "")
     {
         MessageBox.Show("請先登入!", "Facebook", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         return;
     }
     PowerPoint._Application myPPT = Globals.ThisAddIn.Application;
     PowerPoint.Slide Sld = myPPT.ActiveWindow.View.Slide;
     DateTime dt = DateTime.Now;
     string filename = String.Format("{0:DD.HH.MM.ss}", dt);
     Sld.Export("D:\\" + filename + ".jpg", "JPG");
     FileStream stream = new FileStream("D:\\" + filename + ".jpg", FileMode.Open, FileAccess.Read);
     Image img = Image.FromStream(stream);
     stream.Close();
     UploadImage up = new UploadImage(img);
     File.Delete("D:\\" + filename + ".jpg");
     up.Show();
 }
Exemplo n.º 2
0
 private void button4_Click(object sender, RibbonControlEventArgs e)
 {
     if (ThisAddIn.GetAccessToken() == "")
     {
         MessageBox.Show("請先登入!", "Facebook", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         return;
     }
     var tempClipboard = Clipboard.GetDataObject();
     try
     {
         PowerPoint._Application myPPT = Globals.ThisAddIn.Application;
         PowerPoint.Slide Sld = myPPT.ActiveWindow.View.Slide;
         myPPT.ActiveWindow.Selection.Copy();
     }
     catch
     {
         MessageBox.Show("請選取圖片!", "Facebook", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         return;
     }
     if (Clipboard.ContainsImage())
     {
         UploadImage up = new UploadImage(Clipboard.GetImage());
         Clipboard.Clear();
         Clipboard.SetDataObject(tempClipboard);
         up.Show();
     }
     else
     {
         MessageBox.Show("請選取圖片!", "Facebook", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
     }
 }