/// <summary> /// Helper to load Settings and populate the form elements /// <see cref="Settings"/> /// </summary> public void LoadSettings() { // line LineThickness = Settings.LineThickness; tB_LineThickness.Text = LineThickness.ToString(); LineMaxLength = Settings.LineMaxLength; tB_LineMaxLength.Text = LineMaxLength.ToString(); LineDividerLengthFactor = Settings.LineSubdividerLengthFactor; tB_LineDividerLengthFactor.Text = LineDividerLengthFactor.ToString(); ScaleStyle = Settings.Style; lB_ScaleStyle.DataStore = Enum.GetNames(typeof(ScaleOverlay.ScaleStyle)); // text TextHeight = Settings.TextHeight; tB_TextHeight.Text = TextHeight.ToString(); TextFont = Settings.TextFont; fP_TextFont.Value = TextFont.ToEtoFont(); // position OffsetX = Settings.OffsetX; tB_OffsetX.Text = OffsetX.ToString(); OffsetY = Settings.OffsetY; tB_OffsetY.Text = OffsetY.ToString(); TextGap = Settings.TextGap; tB_TextGap.Text = TextGap.ToString(); // color LineColor = Settings.LineColor; btn_LineColor.BackgroundColor = LineColor.ToEto(); TextColor = Settings.TextColor; btn_TextColor.BackgroundColor = TextColor.ToEto(); }
private void tB_TextHeight_TextChanged(object sender, EventArgs e) { if (int.TryParse(tB_TextHeight.Text, out int result)) { TextHeight = result; if (result < Settings.MinTextHeight) { TextHeight = Settings.MinTextHeight; } if (result > Settings.MaxTextHeight) { TextHeight = Settings.MaxTextHeight; } tB_TextHeight.Text = TextHeight.ToString(); } }
/// <summary> /// Converts object to the string of the format specified. /// </summary> /// <param name="format"></param> /// <param name="formatProvider"></param> /// <returns></returns> protected override string ToStringInternal(string format, IFormatProvider formatProvider) { StringBuilder sb = new StringBuilder(); sb.Append("Text(") .Append("p=") .Append(Position.ToString(format, formatProvider)) .Append(",h=") .Append(TextHeight.ToString(format, formatProvider)) .Append(",t=") .Append(Text) .Append(",c=") .Append(Color ?? "null") .Append(')'); return(sb.ToString()); }