コード例 #1
0
ファイル: mwg.Drawing.cs プロジェクト: akinomyoga/mwg
 private void DrawLetter(StringDrawer.Char c)
 {
     //TODO:改行・折り返しに関して実装すべき物
     // 禁則処理
     //	ワードラップ
     //	横スクロール可能の時には使えない様にしないと変な事になる
     //	途中で文字の大きさが変わった時の行送りに対応する
     if (this.Vertical && this.RTL)
     {
         //折り返し処理
         if (this.Return && this.Rectangle.Bottom < this.strPosition.Y + c.Height)
         {
             if (this.Cr())
             {
                 this.Lf();
             }
         }
         c.DrawTo(this.g, this.strPosition.X - c.Width, this.strPosition.Y);
         this.strPosition.Y += c.Height + this.LetterSpacing;
     }
     else if (this.RTL)
     {
         //TEST:折り返し処理
         if (this.Return && this.Rectangle.Left > this.strPosition.X)
         {
             if (this.Cr())
             {
                 this.Lf();
             }
         }
         c.DrawTo(this.g, this.strPosition.X, this.strPosition.Y);
         this.strPosition.X -= c.Width + this.LetterSpacing;
     }
     else if (this.Vertical)
     {
         //折り返し処理
         if (this.Return && this.Rectangle.Bottom < this.strPosition.Y + c.Height)
         {
             if (this.Cr())
             {
                 this.Lf();
             }
         }
         c.DrawTo(this.g, this.strPosition.X + this.LineHeight - c.Width, this.strPosition.Y);
         this.strPosition.Y += c.Height + this.LetterSpacing;
     }
     else
     {
         //折り返し処理
         if (this.Return && this.Rectangle.Right < this.strPosition.X + c.Width)
         {
             if (this.Cr())
             {
                 this.Lf();
             }
         }
         c.DrawTo(this.g, this.strPosition.X, this.strPosition.Y);
         this.strPosition.X += c.Width + this.LetterSpacing;
     }
 }
コード例 #2
0
ファイル: mwg.Drawing.cs プロジェクト: akinomyoga/mwg
 public void DrawChar(System.Drawing.Graphics g, StringDrawer.Char c, float x, float y, float w, float h)
 {
     g.DrawImage(
         c.bmp,
         new System.Drawing.RectangleF(this.Width * x, this.Height * y, this.bmp.Width * w, this.bmp.Height * h)
         );
 }