Exemplo n.º 1
0
        protected void Draw(GraphicsAPI graphics, Font font, Brush brush, string s, Rectangle r)
        {
            Point marginsAlignment = this.GetMarginsAlignment(font, graphics);

            if (this.AlignmentHorizontal.Style == StringAlignment.Near)
            {
                r.Offset(marginsAlignment.X, 0);
            }
            else if (this.AlignmentHorizontal.Style == StringAlignment.Far)
            {
                r.Offset(-marginsAlignment.X, 0);
            }
            if (this.AlignmentVertical.Style == StringAlignment.Near)
            {
                r.Offset(0, marginsAlignment.Y);
            }
            else if (this.AlignmentVertical.Style == StringAlignment.Far)
            {
                r.Offset(0, -marginsAlignment.Y);
            }
            graphics.DrawString(s, font, brush, r, this.StringFormat);
        }
Exemplo n.º 2
0
 public PaintArgs(Graphics graphics, Rectangle r, Color color)
 {
     this.m_ControlBackColor = color;
     this.m_Graphics         = new GraphicsAPI(graphics);
     this.SetRectangle(r);
 }
Exemplo n.º 3
0
 Point ITextLayoutBase.GetMarginsAlignment(Font font, GraphicsAPI graphics)
 {
     return(this.GetMarginsAlignment(font, graphics));
 }
Exemplo n.º 4
0
 Rectangle ITextLayoutBase.GetRectangle(string s, Point pt, Font font, GraphicsAPI graphics)
 {
     return(this.GetRectangle(s, pt, font, graphics));
 }
Exemplo n.º 5
0
 Rectangle ITextLayoutBase.GetRectangle(Rectangle bounds, Font font, GraphicsAPI graphics)
 {
     return(this.GetRectangle(bounds, font, graphics));
 }
Exemplo n.º 6
0
 Size ITextLayoutBase.GetRequiredSize(string s, Font font, int width, GraphicsAPI graphics)
 {
     return(this.GetRequiredSize(s, font, width, graphics));
 }
Exemplo n.º 7
0
 void ITextLayoutBase.Draw(GraphicsAPI graphics, Font font, Brush brush, string s, Rectangle r)
 {
     this.Draw(graphics, font, brush, s, r);
 }
Exemplo n.º 8
0
        private Point GetMarginOffsets(Font font, GraphicsAPI graphics)
        {
            int x = (int)Math.Ceiling((double)graphics.MeasureString("0", font, true).Width *this.Alignment.Margin);

            return(new Point(x, 0));
        }
Exemplo n.º 9
0
 Size ITextLayoutHorizontal.GetRequiredSize(string s, Font font, GraphicsAPI graphics)
 {
     return(this.GetRequiredSize(s, font, graphics));
 }
Exemplo n.º 10
0
 Point ITextLayoutHorizontal.GetMarginOffsets(Font font, GraphicsAPI graphics)
 {
     return(this.GetMarginOffsets(font, graphics));
 }