/// <summary> /// 添加字符 /// </summary> /// <param name="txt"></param> private void AddChar(string txt) { DrawFont defFont = new DrawFont(this.Font.FontFamily.Name); EditorChar editorChar = new EditorChar(txt, defFont); this.View.EditorArea.Add(editorChar); }
private void InsterChar(string txt,int pos) { DrawFont defFont = new DrawFont(this.Font.FontFamily.Name); EditorChar editorChar = new EditorChar(txt, defFont); editorChar.Rectangle = new EditorObjectRectangle(); this.View.EditorArea.Insert(pos, editorChar); }
/// <summary> /// 添加文字 /// </summary> /// <param name="pos">添加的位置</param> /// <param name="font">添加的字体</param> /// <param name="s">添加的内容</param> public void InsertText(int pos, DrawFont font, string s) { if (String.IsNullOrEmpty(s)) return; for (int i = 0; i < s.Length; i++) { EditorChar newChar = new EditorChar(s.Substring(i, 1), font); // 生成字符对象 this.ContentList.Insert(pos, newChar); // 添加字符到列表 this.SelectIndex = pos; } this.SortContent(); }