Esempio n. 1
0
 public DTextInput()
 {
     MType = MemberType.TextInput;
     _firstMember = MDocument.CreateTextChar(EditorSetting.DefaultGraphics, "[");
     _lastMember = MDocument.CreateTextChar(EditorSetting.DefaultGraphics, "]");
     this.Width = LeftMargin + _firstMember.Width + _lastMember.Width + RightMargin;
     this.Height = _firstMember.Height;
     _firstMember.NextMember = _lastMember;
     _lastMember.PreMember = _firstMember;
 }
Esempio n. 2
0
 public override SizeF MeasureString(DTextChar textChar)
 {
     return Context.Graphic.MeasureString(textChar.Value, textChar.WFont, 0, EditorSetting.DefaultStringFormat);
 }
Esempio n. 3
0
 /// <summary>
 /// 测量文本大小
 /// </summary>
 /// <param name="textChar"></param>
 /// <returns></returns>
 public virtual SizeF MeasureString(DTextChar textChar)
 {
     return new SizeF();
 }
Esempio n. 4
0
 /// <summary>
 /// 创建文本对象
 /// </summary>
 /// <param name="text"></param>
 /// <param name="fontName"></param>
 /// <param name="fontSize"></param>
 /// <param name="fontColor"></param>
 /// <param name="fontStyle"></param>
 /// <returns></returns>
 public DTextChar CreateTextChar(string text, string fontName, float fontSize, Color fontColor,
                                 FontStyle fontStyle)
 {
     var dTextChar = new DTextChar { Value = text, FontColor = fontColor, WFont = new Font(fontName, fontSize, fontStyle) };
     var size = Context.Graphic.MeasureString(dTextChar.Value, dTextChar.WFont, 0, EditorSetting.DefaultStringFormat);
     dTextChar.Width = Convert.ToInt32(size.Width);
     dTextChar.Height = Convert.ToInt32(size.Height);
     return dTextChar;
 }