示例#1
0
        private HWImage ConvertImage(XmlNode node)
        {
            HWImage box = new HWImage();

            SetValue(box, node.Attributes);
            return(box);
        }
示例#2
0
        private ContentControl AddImage(HWImage img)
        {
            Image       image       = new Image();
            BitmapImage bitmapImage = ImageHelper.GetImage(img.Res_name);

            image.Source  = bitmapImage;
            image.Width   = bitmapImage.PixelWidth;
            image.Height  = bitmapImage.PixelHeight;
            image.Stretch = Stretch.Fill;

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

            control.Content = image;
            canvas.Children.Add(control);
            DesignerItemDecorator.SetCanResize(control, false);

            Canvas.SetTop(control, img.Y);
            Canvas.SetLeft(control, img.X);
            return(control);
        }
示例#3
0
        /// <summary>
        /// 元素属性发生变化后
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WatchElement_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            HWImage image = watchElement.HWElement as HWImage;

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

            case "Y": image.Y = watchElement.Y; break;
            }
        }