private HWTextareaWithOneWildCard ConverTextareaWithOneWildCard(XmlNode node) { HWTextareaWithOneWildCard box = new HWTextareaWithOneWildCard(); SetValue(box, node.Attributes); return(box); }
private ContentControl AddTextareaWithOneWildCard(HWTextareaWithOneWildCard textareaWithOneWildCard) { TextBlock text = new TextBlock(); text.VerticalAlignment = VerticalAlignment.Center; text.HorizontalAlignment = HorizontalAlignment.Stretch; int value = ConstData.Datas[textareaWithOneWildCard.Data_type]; text.Text = value.ToString(); text.Foreground = new SolidColorBrush(Color.FromArgb(textareaWithOneWildCard.Alpha, textareaWithOneWildCard.Color_red, textareaWithOneWildCard.Color_green, textareaWithOneWildCard.Color_blue)); SetAlignment(text, textareaWithOneWildCard.Alignment_type); SetFontSize(text, textareaWithOneWildCard.Font_type); ContentControl control = new ContentControl { Width = textareaWithOneWildCard.Drawable_width, Height = textareaWithOneWildCard.Drawable_height, Style = (Style)Application.Current.Resources["DesignerItemStyle"] }; control.Content = text; canvas.Children.Add(control); Canvas.SetLeft(control, textareaWithOneWildCard.Drawable_x); Canvas.SetTop(control, textareaWithOneWildCard.Drawable_y); return(control); }
/// <summary> /// 元素属性发生变化后 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WatchElement_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { HWTextareaWithOneWildCard text = watchElement.HWElement as HWTextareaWithOneWildCard; switch (e.PropertyName) { case "X": text.Drawable_x = watchElement.X; break; case "Y": text.Drawable_y = watchElement.Y; break; case "Width": text.Drawable_width = watchElement.Width; break; case "Height": text.Drawable_height = watchElement.Height; break; } RefreshControl(); }