public void DrawChar(string txt, int color, DrawFont font, float x, float y, int angle, IDrawEffect[] effects) { Brush br = new SolidBrush(Color.FromArgb(color)); Font sysFont = this.DrawFontToSharpFont(font); this.m_graphics.DrawString( txt, sysFont, br, new PointF(x, y) ); }
/// <summary> /// 绘制字体类转c# font类 /// </summary> /// <param name="font"></param> /// <returns></returns> private Font DrawFontToSharpFont(DrawFont font) { Font sharpFont = new Font(font.FontName, font.Size); return sharpFont; }
public SizeF GetDrawStringSize(string str, DrawFont font) { SizeF retSize = this.m_graphics.MeasureString(str, this.DrawFontToSharpFont(font)); return retSize; }
public EditorChar(string content,DrawFont font) { this.m_content = content; this.FontColor = System.Drawing.Color.Black.ToArgb(); this.Font = font; }
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="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); }
/// <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(); }
/// <summary> /// 添加文字对象 /// </summary> /// <param name="font"></param> /// <param name="s"></param> public void Add(DrawFont font, string s) { this.InsertText(this.SelectIndex, font, s); }