private void Initialize(Label textBlock, double fontsize, bool allowCropping, bool allowSplittingWords) { Effect effect = Effect.Resolve("VisiPlacement.TextItemEffect"); textBlock.Effects.Add(effect); textBlock.Margin = new Thickness(0); textBlock.TextColor = Color.LightGray; this.textBlock = textBlock; this.layouts = new List <LayoutChoice_Set>(); if (fontsize > 0) { if (allowCropping || allowSplittingWords) { layouts.Add(this.makeLayout(fontsize, allowCropping, allowSplittingWords)); } layouts.Add(this.makeLayout(fontsize, false, false)); } else { layouts.Add(this.makeLayout(30, false, false)); layouts.Add(this.makeLayout(16, false, false)); layouts.Add(this.makeLayout(10, false, false)); if (allowCropping || allowSplittingWords) { layouts.Add(this.makeLayout(10, allowCropping, allowSplittingWords)); } } this.SubLayout = LayoutUnion.New(layouts); }
private void initialize(Editor textBox, IEnumerable <double> fontSizes) { if (fontSizes == null) { fontSizes = new List <double>() { 30, 16 } } ; Effect effect = Effect.Resolve("VisiPlacement.TextItemEffect"); textBox.Effects.Add(effect); textBox.Margin = new Thickness(); this.TextBox = textBox; textBox.BackgroundColor = Color.LightGray; this.TextBox.Margin = new Thickness(); TextBox_Configurer configurer = new TextBox_Configurer(textBox); double minFontSize = -1; foreach (double fontSize in fontSizes) { if (minFontSize < 0 || fontSize < minFontSize) { minFontSize = fontSize; } this.layouts.Add(new TextLayout(configurer, fontSize)); } if (minFontSize > 0) { this.layouts.Add(new TextLayout(configurer, minFontSize, true)); } this.SubLayout = LayoutUnion.New(layouts); }