Ejemplo n.º 1
0
        void ZoomIn(int x, int y)
        {
            zoomCanvas = new KEAPCanvas();
            zoomCanvas.Width = AudienceCanvas.Width;
            zoomCanvas.Height = AudienceCanvas.Height;
            zoomCanvas.Background = null;

            Rectangle rec_BG = new Rectangle()
            {
                Width = SystemParameters.WorkArea.Width,
                Height = SystemParameters.PrimaryScreenHeight,
                Stroke = null,
                Fill = AudienceCanvas.Background
            };
            Canvas.SetLeft(rec_BG, -(SystemParameters.WorkArea.Width * x / 8)); //* (120 / 96)
            Canvas.SetTop(rec_BG, -(WindowSettings.resolution_Height * y / 8)); //* (120 / 96)
            zoomCanvas.Children.Add(rec_BG);

            UIElement[] copyuiele = new UIElement[AudienceCanvas.Children.Count];
            AudienceCanvas.Children.CopyTo(copyuiele, 0);
            foreach (UIElement ele in copyuiele)
            {
                if (ele is EditableTextBlock)
                {
                    EditableTextBlock copyele = ele as EditableTextBlock;
                    EditableTextBlock textblock = new EditableTextBlock()
                    {
                        Text = copyele.Text,
                        Width = copyele.Width,
                        Height = copyele.Height,
                        FontSize = copyele.FontSize,
                        TextAlignment = copyele.TextAlignment,
                        Effect = copyele.Effect,
                        FontWeight = copyele.FontWeight,
                        FontFamily = copyele.FontFamily,
                        Background = copyele.Background,
                        Foreground = copyele.Foreground,
                        TextDecorations = copyele.TextDecorations
                    };
                    Canvas.SetLeft(textblock,Canvas.GetLeft(copyele));
                    Canvas.SetTop(textblock,Canvas.GetTop(copyele));

                    double x1 = Canvas.GetLeft(ele),
                        y1 = Canvas.GetTop(ele);

                    Canvas.SetLeft(textblock, x1 - (SystemParameters.PrimaryScreenWidth * x / 8));
                    Canvas.SetTop(textblock, y1 - (SystemParameters.PrimaryScreenHeight * y / 8));

                    zoomCanvas.Children.Add(textblock);
                }
                else if (ele is Polygon)
                {
                    Polygon copyele = ele as Polygon;
                    Polygon polygon = new Polygon()
                    {
                        Points = copyele.Points,
                        Stroke = copyele.Stroke,
                        StrokeThickness = copyele.StrokeThickness,
                        Fill = copyele.Fill
                    };

                    Point[] copy_points = new Point[polygon.Points.Count];
                    PointCollection copy_collection = new PointCollection();
                    polygon.Points.CopyTo(copy_points, 0);
                    for (int i = 0; i < polygon.Points.Count; i++)
                    {
                        copy_points[i].X = copy_points[i].X - (SystemParameters.WorkArea.Width * x / 8);
                        copy_points[i].Y = copy_points[i].Y - (SystemParameters.PrimaryScreenHeight * y / 8);
                        copy_collection.Add(copy_points[i]);
                    }
                    polygon.Points = copy_collection;

                    zoomCanvas.Children.Add(polygon);
                }
                else if (ele is Line)
                {
                    Line copyele = ele as Line;
                    Line line = new Line()
                    {
                        X1 = copyele.X1,
                        Y1 = copyele.Y1,
                        X2 = copyele.X2,
                        Y2 = copyele.Y2,
                        Stroke = copyele.Stroke,
                        StrokeThickness = copyele.StrokeThickness,
                    };

                    line.X1 = ((Line)ele).X1 - (SystemParameters.WorkArea.Width * x / 8);
                    line.Y1 = ((Line)ele).Y1 - (SystemParameters.PrimaryScreenHeight * y / 8);
                    line.X2 = ((Line)ele).X2 - (SystemParameters.WorkArea.Width * y / 8);
                    line.Y2 = ((Line)ele).Y2 - (SystemParameters.PrimaryScreenHeight * y / 8);

                    zoomCanvas.Children.Add(line);
                }
                else if (ele is Image)
                {
                    Image copyele = ele as Image;
                    Image image = new Image()
                    {
                        Source = copyele.Source,
                        Width = copyele.Width,
                        Height = copyele.Height,
                    };
                    Canvas.SetLeft(image, Canvas.GetLeft(copyele));
                    Canvas.SetTop(image, Canvas.GetTop(copyele));

                    double x1 = Canvas.GetLeft(ele),
                        y1 = Canvas.GetTop(ele);

                    Canvas.SetLeft(image, x1 - (SystemParameters.WorkArea.Width * x / 8));
                    Canvas.SetTop(image, y1 - (SystemParameters.PrimaryScreenHeight * y / 8));

                    zoomCanvas.Children.Add(image);
                }
                else if (ele is Rectangle)
                {
                    Rectangle copyele = ele as Rectangle;
                    Rectangle rectangle = new Rectangle()
                    {
                        Width = copyele.Width,
                        Height = copyele.Height,
                        Fill = copyele.Fill,
                        Stroke = copyele.Stroke,
                        StrokeThickness = copyele.StrokeThickness
                    };
                    Canvas.SetLeft(rectangle, Canvas.GetLeft(copyele));
                    Canvas.SetTop(rectangle, Canvas.GetTop(copyele));

                    double x1 = Canvas.GetLeft(ele),
                        y1 = Canvas.GetTop(ele);

                    Canvas.SetLeft(rectangle, x1 - (SystemParameters.WorkArea.Width * x / 8));
                    Canvas.SetTop(rectangle, y1 - (SystemParameters.PrimaryScreenHeight * y / 8));

                    zoomCanvas.Children.Add(rectangle);
                }
                else if (ele is Ellipse)
                {
                    Ellipse copyele = ele as Ellipse;
                    Ellipse ellipse = new Ellipse()
                    {
                        Width = copyele.Width,
                        Height = copyele.Height,
                        Fill = copyele.Fill,
                        Stroke = copyele.Stroke,
                        StrokeThickness = copyele.StrokeThickness
                    };
                    Canvas.SetLeft(ellipse, Canvas.GetLeft(copyele));
                    Canvas.SetTop(ellipse, Canvas.GetTop(copyele));

                    double x1 = Canvas.GetLeft(ele),
                        y1 = Canvas.GetTop(ele);

                    Canvas.SetLeft(ellipse, x1 - (SystemParameters.WorkArea.Width * x / 8));
                    Canvas.SetTop(ellipse, y1 - (SystemParameters.PrimaryScreenHeight * y / 8));

                    zoomCanvas.Children.Add(ellipse);
                }
            }

            AudienceGrid.Background = null;
            zoomCanvas.UpdateLayout();
            zoom_img = new Image();

            FrameworkElement TargetVisual = zoomCanvas as FrameworkElement;
            int width, height;
            TargetVisual.Arrange(new Rect(0, 0, 0, 0));
            width = (int)TargetVisual.ActualWidth;
            height = (int)TargetVisual.ActualHeight;
            if(TargetVisual.RenderTransform!=null)
            {
                Rect bounds = new Rect(0, 0, TargetVisual.ActualWidth, TargetVisual.ActualHeight);
                bounds = TargetVisual.RenderTransform.TransformBounds(bounds);
                TargetVisual.Arrange(new Rect(-bounds.Left, -bounds.Top, width, height));
                width = (int)bounds.Width;
                height = (int)bounds.Height;
            }

            //RenderTargetBitmap zoom_rtb = new RenderTargetBitmap(width/4 + 402, height/4 + 237, 96d, 96d, System.Windows.Media.PixelFormats.Default);
            //RenderTargetBitmap zoom_rtb = new RenderTargetBitmap(width/4, height/4, 96d, 96d, System.Windows.Media.PixelFormats.Default);
            RenderTargetBitmap zoom_rtb = new RenderTargetBitmap(((width/4)+402), ((height/4)+237), 96d, 96d, System.Windows.Media.PixelFormats.Default);
            AudienceGrid.Children.Insert(0, zoomCanvas);
            AudienceGrid.Children.Remove(AudienceCanvas);
            zoomCanvas.UpdateLayout();
            AudienceGrid.UpdateLayout();
            zoom_rtb.Render(TargetVisual);
            zoom_img.Source = zoom_rtb;
            zoom_img.HorizontalAlignment = HorizontalAlignment.Stretch;
            zoom_img.VerticalAlignment = VerticalAlignment.Stretch;
            zoom_img.Stretch = Stretch.Fill;
            //AudienceGrid.Children.Remove(AudienceCanvas);
            zoom_img.Width = SystemParameters.WorkArea.Width;
            zoom_img.Height = SystemParameters.MaximizedPrimaryScreenHeight;

            AudienceGrid.Children.Add(zoom_img);

            AudienceGrid.Children.Remove(zoomCanvas);
            //AudienceGrid.Background = new ImageBrush(zoom_img.Source);
            //AudienceGrid.Background = new SolidColorBrush(Colors.Blue);
        }
Ejemplo n.º 2
0
        private void Audience_Loaded(object sender, RoutedEventArgs e)
        {
            this.WindowState = System.Windows.WindowState.Maximized;
            Keyboard.Focus(this);
            AudienceCanvas = new KEAPCanvas()
            {
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                Background = new SolidColorBrush(Colors.White)
            };
            AudienceCanvas.Width = SystemParameters.WorkArea.Width;// * (100 / 96);
            AudienceCanvas.Height = SystemParameters.MaximizedPrimaryScreenHeight;// *(100 / 96);
            AudienceCanvas = canvas_arr[0];
            AudienceCanvas.PreviewMouseLeftButtonDown += AudienceCanvas_PreviewMouseLeftButtonDown;
            AudienceCanvas.PreviewMouseRightButtonDown += AudienceCanvas_PreviewMouseRightButtonDown;
            AudienceGrid.Children.Add(AudienceCanvas);

            List<Dictionary<int, string>> anilist;
            if(animations.Keys.Contains(canvas_index))
                anilist = animations[canvas_index];
            else
                anilist = null;
            if (anilist != null)
            {
                foreach (Dictionary<int, string> dic in anilist)
                {
                    animation_indexes.Add(dic.Keys.First());
                }
            }
        }
Ejemplo n.º 3
0
        void Slide_Turn(int p_Slide_Index)
        {
            if((canvas_index+p_Slide_Index)<0 || (canvas_index+p_Slide_Index)>=canvas_arr.Count) return;
            canvas_index+=p_Slide_Index;

            if (!(canvas_arr.Count > canvas_index)) return;
            AudienceCanvas.PreviewMouseLeftButtonDown -= AudienceCanvas_PreviewMouseLeftButtonDown;
            AudienceCanvas.PreviewMouseRightButtonDown -= AudienceCanvas_PreviewMouseRightButtonDown;
            AudienceGrid.Children.Remove(AudienceCanvas);
            AudienceCanvas = new KEAPCanvas()
            {
                VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                Background = new SolidColorBrush(Colors.White)
            };
            AudienceCanvas.Width = SystemParameters.WorkArea.Width * (100 / 96);
            AudienceCanvas.Height = SystemParameters.MaximizedPrimaryScreenHeight * (100 / 96);

            AudienceCanvas = canvas_arr[canvas_index];
            AudienceCanvas.PreviewMouseLeftButtonDown += AudienceCanvas_PreviewMouseLeftButtonDown;
            AudienceCanvas.PreviewMouseRightButtonDown += AudienceCanvas_PreviewMouseRightButtonDown;
            AudienceGrid.Children.Add(AudienceCanvas);

            List<Dictionary<int, string>> anilist;
            if (canvas_index < animations.Count)
                anilist = animations[canvas_index];
            else
                anilist = null;
            if (anilist != null)
            {
                animation_indexes.Clear();
                foreach (Dictionary<int, string> dic in anilist)
                {
                    animation_indexes.Add(dic.Keys.First());
                }
            }
            animation_index = 0;
        }
Ejemplo n.º 4
0
        public void DefaultCall()
        {
            if (DefaultPageNum == -1) return;

            if (!toggle)
            {
                AudienceGrid.Children.Remove(AudienceCanvas);
                container = canvas_arr.IndexOf(AudienceCanvas);
                AudienceCanvas = canvas_arr[DefaultPageNum];
                AudienceGrid.Children.Add(AudienceCanvas);
                toggle = true;
            }
            else
            {
                AudienceGrid.Children.Remove(AudienceCanvas);
                AudienceCanvas=canvas_arr[container];
                AudienceGrid.Children.Add(AudienceCanvas);
                toggle = false;
            }
        }