public SimpleSlideShowWindow() { InitializeComponent(); SetUpCanvasses(); DisableClickAdvance(); isExtendedDesktopMode = false; isExtendedDesktopMode = true; this.Height = System.Windows.Forms.Screen.AllScreens[0].WorkingArea.Height; this.Width = System.Windows.Forms.Screen.AllScreens[0].WorkingArea.Width; slideThumbs = new ObservableCollection<SlideThumbnail>(); strokeCollectionsForSlides = new Dictionary<int, StrokeCollection>(); pens = new List<UbiquitousPen> { new UbiquitousPen{penName="thinBlack",penColour=System.Windows.Media.Brushes.Black,penWeight=1.5f}, new UbiquitousPen{penName="thinRed",penColour=System.Windows.Media.Brushes.Red,penWeight=1.5f}, new UbiquitousPen{penName="thinYellow",penColour=System.Windows.Media.Brushes.Yellow,penWeight=1.5f}, new UbiquitousPen{penName="thinBlue",penColour=System.Windows.Media.Brushes.Blue,penWeight=1.5f}, new UbiquitousPen{penName="thinGreen",penColour=System.Windows.Media.Brushes.Green,penWeight=1.5f}, new UbiquitousPen{penName="thinDarkBlue",penColour=System.Windows.Media.Brushes.DarkBlue,penWeight=1.5f}, new UbiquitousPen{penName="medRed",penColour=System.Windows.Media.Brushes.Red,penWeight=3f}, new UbiquitousPen{penName="medBlue",penColour=System.Windows.Media.Brushes.Blue,penWeight=3f}, new UbiquitousPen{penName="medwhite",penColour=System.Windows.Media.Brushes.Yellow,penWeight=3f}, new UbiquitousPen{penName="thinWhite",penColour=System.Windows.Media.Brushes.White,penWeight=1.5f} }; currentPen = pens[0]; GenerateThumbnails(); SlideViewer.Items.Clear(); SlideViewer.ItemsSource = slideThumbs; SlideViewer.Items.SortDescriptions.Add(new System.ComponentModel.SortDescription("slideNumber", System.ComponentModel.ListSortDirection.Ascending)); PensControl.Items.Clear(); PensControl.ItemsSource = pens; lastSlide = ThisAddIn.instance.Application.ActivePresentation.SlideShowWindow.View.Slide.SlideID; SlideMoved(); }
private void addStrokeToPowerpointPresentation(System.Windows.Ink.Stroke stroke, int SlideNumber) { try { Single[,] arrayOfPoints = new Single[stroke.StylusPoints.Count, 2]; var AP = ThisAddIn.instance.Application.ActivePresentation; for (int i = 0; i < stroke.StylusPoints.Count; i++) { arrayOfPoints[i, 0] = (float)stroke.StylusPoints[i].X; arrayOfPoints[i, 1] = (float)stroke.StylusPoints[i].Y; } var strokeColor = new SolidColorBrush(new System.Windows.Media.Color { A = stroke.DrawingAttributes.Color.A, R = stroke.DrawingAttributes.Color.R, G = stroke.DrawingAttributes.Color.G, B = stroke.DrawingAttributes.Color.B }); UbiquitousPen currentStrokeAttributes = new UbiquitousPen { penColour = strokeColor, penWeight = (float)stroke.DrawingAttributes.Height, penName = "temporaryBrush" }; var currentSlide = AP.Slides[SlideNumber]; var newShape = currentSlide.Shapes.AddPolyline(arrayOfPoints); newShape.Line.Weight = currentStrokeAttributes.penWeight; newShape.Line.ForeColor.RGB = currentStrokeAttributes.RGBAasInt; newShape.Line.BackColor.RGB = currentStrokeAttributes.RGBAasInt; } catch (Exception ex) { MessageBox.Show("failed to add stroke: " + ex.Message); } }
private void Pen(object sender, RoutedEventArgs e) { DisableClickAdvance(); currentPen = pens.Where(c => c.penName.Equals(((FrameworkElement)sender).Tag.ToString())).First(); ThisAddIn.instance.Application.ActivePresentation.SlideShowWindow.View.PointerColor.RGB = currentPen.RGBAasInt; ThisAddIn.instance.Application.ActivePresentation.SlideShowWindow.View.PointerType = PpSlideShowPointerType.ppSlideShowPointerPen; foreach (InkCanvas canvas in ActiveCanvasses) { canvas.DefaultDrawingAttributes = new System.Windows.Ink.DrawingAttributes { Width = currentPen.penWeight, Height = currentPen.penWeight, Color = new System.Windows.Media.Color { A = (byte)currentPen.A, R = (byte)currentPen.R, G = (byte)currentPen.G, B = (byte)currentPen.B } }; canvas.EditingMode = InkCanvasEditingMode.Ink; } ReFocusPresenter(); }