private HWImage ConvertImage(XmlNode node) { HWImage box = new HWImage(); SetValue(box, node.Attributes); return(box); }
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); }
/// <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; } }