示例#1
0
        private void UpdateTableTemplate(Control c, TableShape shape, string color)
        {
            SolidColorBrush brush = (SolidColorBrush) new BrushConverter().ConvertFromString(color);

            if (shape == TableShape.Rectangle)
            {
                c.Template = ButtonFactory.GetRectangle(brush);
            }
            else
            {
                c.Template = ButtonFactory.GetCircle(brush);
            }
        }
示例#2
0
        private void CreateTable(Table model)
        {
            Button el = new Button();

            el.Content = model.Text;
            el.Name    = model.Id;
            el.Width   = model.Width;
            el.Height  = model.Height;
            Canvas.SetLeft(el, model.X);
            Canvas.SetTop(el, model.Y);
            el.BorderBrush = Brushes.Red;
            if (model.Shape == TableShape.Circle)
            {
                el.Template = ButtonFactory.GetCircle((SolidColorBrush) new BrushConverter().ConvertFromString(model.Color));
            }
            else
            {
                el.Template = ButtonFactory.GetRectangle((SolidColorBrush) new BrushConverter().ConvertFromString(model.Color));
            }

            C.Children.Add(el);
        }