public TextBlockPropertiesViewModel(ElementTextBlock elementTextBlock) { Title = "Свойства фигуры: Надпись"; _elementTextBlock = elementTextBlock; CopyProperties(); Fonts = new List<string>(); foreach (var fontfamily in System.Drawing.FontFamily.Families) { Fonts.Add(fontfamily.Name); } }
public override ElementBase Clone() { ElementTextBlock elementBase = new ElementTextBlock() { Text = Text, BackgroundColor = BackgroundColor, ForegroundColor = ForegroundColor, BorderColor = BorderColor, BorderThickness = BorderThickness, FontSize = FontSize, FontFamilyName = FontFamilyName }; Copy(elementBase); return elementBase; }
public TextBlockPropertiesViewModel(ElementTextBlock elementTextBlock) { Title = "Свойства фигуры: Надпись"; _elementTextBlock = elementTextBlock; CopyProperties(); Fonts = new List<string>(); foreach (var fontfamily in System.Drawing.FontFamily.Families) Fonts.Add(fontfamily.Name); TextAlignments = new List<string>() { "По левому краю", "По правому краю", "По центру", }; }
public override ElementBase Clone() { ElementTextBlock elementBase = new ElementTextBlock(); Copy(elementBase); return elementBase; }
void AddLabel(Plan plan, surfacesSurfaceLayerElementsElement innerElement, bool stretch = false) { try { var elementTextBlock = new ElementTextBlock() { Text = innerElement.caption, Left = Parse(innerElement.rect[0].left), Top = Parse(innerElement.rect[0].top), Height = Parse(innerElement.rect[0].bottom) - Parse(innerElement.rect[0].top), Width = Parse(innerElement.rect[0].right) - Parse(innerElement.rect[0].left), Stretch = true, FontBold = false, FontItalic = false, }; FontFamily fontFamily = new FontFamily("Arial"); double fontDpiSize = elementTextBlock.Height / 2; double fontHeight = Math.Ceiling(fontDpiSize * fontFamily.LineSpacing); elementTextBlock.FontSize = fontHeight; if (innerElement.brush != null) try { elementTextBlock.BackgroundColor = ConvertColor(innerElement.brush[0].color); } catch (Exception e) { Logger.Error(e, "Исключение при вызове ConfigurationConverter.ConvertPlans"); } if (innerElement.pen != null) try { elementTextBlock.ForegroundColor = ConvertColor(innerElement.pen[0].color); } catch (Exception e) { Logger.Error(e, "Исключение при вызове ConfigurationConverter.ConvertPlans innerElementLayer.pen"); } plan.ElementTextBlocks.Add(elementTextBlock); } catch (Exception e) { Logger.Error(e, "ConfigurationConverter.AddLabel"); } }
protected override Infrustructure.Plans.Elements.ElementBaseRectangle CreateElement() { var element = new ElementTextBlock(); var propertiesViewModel = new TextBlockPropertiesViewModel(element); return DialogService.ShowModalWindow(propertiesViewModel) ? element : null; }