예제 #1
0
        public StyleButton(MainWindow owner, Color backgroundColor, BackgroundColorStyle backgroundStyle, Color foregroundColor)
        {
            this.backgroundColor = backgroundColor;
            this.backgroundStyle = backgroundStyle;
            this.foregroundColor = foregroundColor;
            this.owner           = owner;
            this.Background      = Brushes.White;
            this.Width           = 40;
            this.Height          = 40;
            this.Margin          = new System.Windows.Thickness(2);
            this.Focusable       = false;

            Canvas canvas = new Canvas();

            this.Content = canvas;
            this.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
            this.VerticalContentAlignment   = System.Windows.VerticalAlignment.Top;

            MyShape shape = ShapeFactory.CreateFlowchartSymbol9();

            shape.Draw(28, 28, new MyPoint(0, 0), Statics.CreateBackgroundBrush(backgroundColor, backgroundStyle), OnMouseDown, canvas);

            TextBlock textBlock = new TextBlock();

            textBlock.Foreground       = new SolidColorBrush(foregroundColor);
            textBlock.Text             = "A";
            textBlock.IsHitTestVisible = false;
            textBlock.Margin           = new System.Windows.Thickness(10, 5, 0, 0);

            canvas.Children.Add(textBlock);

            this.Click += OnClick;
        }
예제 #2
0
        private void updatesyleBorders()
        {
            Color color = ((SolidColorBrush)(colorBorder1.Background)).Color;

            styleBorder1.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.Solid);
            styleBorder2.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.Radial);
            styleBorder3.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.LeftToRight);
            styleBorder4.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.RightToLeft);
            styleBorder5.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.TopToBottom);
            styleBorder6.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.BottomToTop);
            styleBorder7.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.TopLeftToBottomRight);
            styleBorder8.Background = Statics.CreateBackgroundBrush(color, BackgroundColorStyle.BottomRightToTopLeft);
        }