示例#1
0
        private HWBox ConvertBox(XmlNode node)
        {
            HWBox box = new HWBox();

            SetValue(box, node.Attributes);
            return(box);
        }
示例#2
0
        /// <summary>
        /// 元素属性发生变化后
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WatchElement_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            HWBox box = watchElement.HWElement as HWBox;

            switch (e.PropertyName)
            {
            case "X": box.Drawable_x = watchElement.X; break;

            case "Y": box.Drawable_y = watchElement.Y; break;

            case "Width": box.Drawable_width = watchElement.Width; break;

            case "Height": box.Drawable_height = watchElement.Height; break;
            }
        }
示例#3
0
        private ContentControl AddBox(HWBox box)
        {
            Rectangle rect = new Rectangle()
            {
                Fill            = new SolidColorBrush(Color.FromRgb(box.Color_red, box.Color_green, box.Color_blue)),
                StrokeThickness = 0
            };

            ContentControl control = new ContentControl
            {
                Width  = box.Drawable_width,
                Height = box.Drawable_height,
                Style  = (Style)Application.Current.Resources["DesignerItemStyle"]
            };

            control.Content = rect;
            canvas.Children.Add(control);

            Canvas.SetLeft(control, box.Drawable_x);
            Canvas.SetTop(control, box.Drawable_y);
            return(control);
        }