示例#1
0
        public virtual void InitializeCard(Color?maskColor, Point defaultPosi, double defaultDegree, double defaultScale, int zidx)
        {
            this.backgroundColor           = Colors.White;
            backgroundRect.Width           = STATICS.DEAULT_CARD_SIZE.Width;
            backgroundRect.Height          = STATICS.DEAULT_CARD_SIZE.Height;
            backgroundRect.StrokeThickness = 2;
            backgroundRect.Stroke          = new SolidColorBrush(maskColor != null ? maskColor.Value : Colors.Black);
            backgroundRect.Fill            = new SolidColorBrush(backgroundColor);
            Matrix mtx = new Matrix();

            mtx.Translate(-backgroundRect.Width / 2, -backgroundRect.Height / 2);
            backgroundRect.RenderTransform = new MatrixTransform(mtx);

            ResetBrightness();

            sortingGroupText.Foreground      = new SolidColorBrush(Colors.Gray);
            sortingGroupText.FontSize        = 14;
            sortingGroupText.FontFamily      = new FontFamily("Quartz MS");
            sortingGroupText.TextWrapping    = TextWrapping.WrapWithOverflow;
            sortingGroupText.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1, -backgroundRect.Width / 2 + 7, -backgroundRect.Height / 2 - 14));

            Matrix matrix = Matrix.Identity;

            matrix.Translate(-backgroundRect.Width / 2, -backgroundRect.Height / 2 + 5);
            matrix.Rotate(180);
            matrix.Translate(-5, 9);

            hightlightMask.Width  = this.Width;
            hightlightMask.Height = this.Height;
            hightlightMask.Fill   = Brushes.Transparent;
            this.hightlightMask.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                                                                                 -hightlightMask.Width / 2,
                                                                                 -hightlightMask.Height / 2));


            linkingIcon = new Linking_Icon(this);
            linkingIcon.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                                                                         +backgroundRect.Width / 2 - linkingIcon.Width,
                                                                         -(backgroundRect.Height / 2)));
            linkingIcon.Opacity = 0;

            copyIcon = new Copy_Icon(this);
            copyIcon.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                                                                      +backgroundRect.Width / 2 - copyIcon.Width,
                                                                      +(backgroundRect.Height / 2 - copyIcon.Height)));
            copyIcon.Opacity = 0;

            this.Container.Children.Add(hightlightMask);
            this.Container.Children.Add(backgroundRect);
            this.Container.Children.Add(sortingGroupText);


            defaultPostion  = defaultPosi;
            defaultRotation = defaultDegree;
            positCard(defaultPostion);
            rotateCard(defaultRotation);
            scaleCard(defaultScale);
            this.zIndex = zidx;
        }
        public void InitializeCard(String imgFile, String cardTxt, Color maskColor, Point defaultPosi, double defaultDegree, double defaultScale, int zidx)
        {
            SetCardImage(imgFile);

            this.backgroundColor = maskColor;
            background.Width = STATICS.DEAULT_CARD_SIZE.Width;
            background.Height = STATICS.DEAULT_CARD_SIZE.Height;
            background.Opacity = 1;
            background.StrokeThickness = 0;
            background.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                       -background.Width / 2,
                       -background.Height / 2));
            background.Opacity = 0.9;
            Rectangle shine = new Rectangle();
            shine.Width = STATICS.DEAULT_CARD_SIZE.Width;
            shine.Height = STATICS.DEAULT_CARD_SIZE.Height;
            shine.Opacity = 0.3;
            ImageBrush ib = new ImageBrush();
            ib.ImageSource = new BitmapImage(new Uri(@"Resource\Image\card_bg.png", UriKind.Relative));
            shine.Fill = ib;
            shine.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                       -background.Width / 2,
                       -background.Height / 2));

            ResetBrightness();

            this.cardText = cardTxt;
            topText.Text = this.cardText;
            bottomText.Text = this.cardText;

            topText.Foreground = new SolidColorBrush(Colors.White);
            topText.FontSize = 16;
            topText.Width = background.Width;
            topText.TextWrapping = TextWrapping.WrapWithOverflow;
            topText.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1, -background.Width / 2 + 7, -background.Height / 2 + 3));

            sortingGroupText.Foreground = new SolidColorBrush(Colors.Black);
            sortingGroupText.FontSize = 14;
            sortingGroupText.FontFamily = new FontFamily("Quartz MS");
            sortingGroupText.TextWrapping = TextWrapping.WrapWithOverflow;
            sortingGroupText.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1, -background.Width / 2 + 7, -background.Height / 2 - 14));

            Matrix matrix = Matrix.Identity;
            matrix.Translate(-background.Width / 2, -background.Height / 2 + 5);
            matrix.Rotate(180);
            matrix.Translate(-5, 9);
            bottomText.RenderTransform = new MatrixTransform(matrix);
            bottomText.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
            bottomText.FontSize = 16;
            bottomText.Width = background.Width;
            bottomText.TextWrapping = TextWrapping.WrapWithOverflow;

            hightlightMask.Width = this.Width;
            hightlightMask.Height = this.Height;
            hightlightMask.Fill = Brushes.Transparent;
            this.hightlightMask.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                       -background.Width / 2,
                       -background.Height / 2));

            linkingIcon = new Linking_Icon(this);
            linkingIcon.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                -linkingIcon.Width / 2,
                -(background.Height - linkingIcon.Height / 2)));
            linkingIcon.Opacity = 0;

            copyIcon = new Copy_Icon(this);
            copyIcon.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                -copyIcon.Width / 2,
                -copyIcon.Height / 2));
            copyIcon.Opacity = 0;

            this.Container.Children.Add(hightlightMask);
            this.Container.Children.Add(background);
            this.Container.Children.Add(shine);
            this.Container.Children.Add(image);
            this.Container.Children.Add(topText);
            this.Container.Children.Add(bottomText);
            this.Container.Children.Add(sortingGroupText);

            defaultPostion = defaultPosi;
            defaultRotation = defaultDegree;
            positCard(defaultPostion);
            rotateCard(defaultRotation);
            scaleCard(defaultScale);
            this.zIndex = zidx;
        }
示例#3
0
        public virtual void InitializeCard(Color? maskColor, Point defaultPosi, double defaultDegree, double defaultScale, int zidx)
        {
            this.backgroundColor = Colors.White;
            backgroundRect.Width = STATICS.DEAULT_CARD_SIZE.Width;
            backgroundRect.Height = STATICS.DEAULT_CARD_SIZE.Height;
            backgroundRect.StrokeThickness = 2;
            backgroundRect.Stroke = new SolidColorBrush(maskColor != null ? maskColor.Value : Colors.Black);
            backgroundRect.Fill = new SolidColorBrush(backgroundColor);
            Matrix mtx = new Matrix();
            mtx.Translate(-backgroundRect.Width / 2, -backgroundRect.Height / 2);
            backgroundRect.RenderTransform = new MatrixTransform(mtx);

            ResetBrightness();

            sortingGroupText.Foreground = new SolidColorBrush(Colors.Gray);
            sortingGroupText.FontSize = 14;
            sortingGroupText.FontFamily = new FontFamily("Quartz MS");
            sortingGroupText.TextWrapping = TextWrapping.WrapWithOverflow;
            sortingGroupText.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1, -backgroundRect.Width / 2 + 7, -backgroundRect.Height / 2 - 14));

            Matrix matrix = Matrix.Identity;
            matrix.Translate(-backgroundRect.Width / 2, -backgroundRect.Height / 2 + 5);
            matrix.Rotate(180);
            matrix.Translate(-5, 9);

            hightlightMask.Width = this.Width;
            hightlightMask.Height = this.Height;
            hightlightMask.Fill = Brushes.Transparent;
            this.hightlightMask.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                       -hightlightMask.Width / 2,
                       -hightlightMask.Height / 2));

            linkingIcon = new Linking_Icon(this);
            linkingIcon.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                +backgroundRect.Width/2- linkingIcon.Width,
                -(backgroundRect.Height/2)));
            linkingIcon.Opacity = 0;

            copyIcon = new Copy_Icon(this);
            copyIcon.RenderTransform = new MatrixTransform(new Matrix(1, 0, 0, 1,
                 +backgroundRect.Width / 2 - copyIcon.Width,
                 +(backgroundRect.Height / 2-copyIcon.Height)));
            copyIcon.Opacity = 0;

            this.Container.Children.Add(hightlightMask);
            this.Container.Children.Add(backgroundRect);
            this.Container.Children.Add(sortingGroupText);

            defaultPostion = defaultPosi;
            defaultRotation = defaultDegree;
            positCard(defaultPostion);
            rotateCard(defaultRotation);
            scaleCard(defaultScale);
            this.zIndex = zidx;
        }