예제 #1
0
 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)
         );
 }
예제 #2
0
        /// <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;
        }
예제 #3
0
 public SizeF GetDrawStringSize(string str, DrawFont font)
 {
     SizeF retSize = this.m_graphics.MeasureString(str,  this.DrawFontToSharpFont(font));
     return retSize;
 }
예제 #4
0
 public EditorChar(string content,DrawFont font)
 {
     this.m_content = content;
     this.FontColor = System.Drawing.Color.Black.ToArgb();
     this.Font = font;
 }
예제 #5
0
 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);
 }
예제 #6
0
 /// <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);
 }
예제 #7
0
        /// <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();
        }
예제 #8
0
 /// <summary>
 /// 添加文字对象
 /// </summary>
 /// <param name="font"></param>
 /// <param name="s"></param>
 public void Add(DrawFont font, string s)
 {
     this.InsertText(this.SelectIndex, font, s);
 }