示例#1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            this.context = new GlyphContext();
            this.context.SetFont(new Font("Arial", 20f));

            Glyph page = factory.CreatePage();

            Glyph column1 = factory.CreateColumn();

            column1.X      = 10;
            column1.Y      = 10;
            column1.Width  = 380;
            column1.Height = 380;

            Glyph column2 = factory.CreateColumn();

            column2.X      = 410;
            column2.Y      = 10;
            column2.Width  = 380;
            column2.Height = 380;

            Glyph row1 = factory.CreateRow();
            Glyph row2 = factory.CreateRow();
            Glyph row3 = factory.CreateRow();


            page.Insert(column1, null);
            page.Insert(column2, null);

            column1.Insert(row1, null);
            column1.Insert(row2, null);

            column2.Insert(row3, null);

            char[] charArray = "Abc".ToCharArray();

            foreach (var item in charArray)
            {
                row1.Insert(factory.CreateCharacter(item), null);
            }


            charArray = "APPARENT".ToCharArray();

            foreach (var item in charArray)
            {
                row2.Insert(factory.CreateCharacter(item), null);
            }


            charArray = "xyz".ToCharArray();

            foreach (var item in charArray)
            {
                row3.Insert(factory.CreateCharacter(item), null);
            }


            page.Draw(this, null);
        }
示例#2
0
        public override void Draw(Form window, GlyphContext context)
        {
            int currentX = this.X;
            int currentY = this.Y;

            int maxSize = 0;

            foreach (var character in this.glyphs)
            {
                character.X = currentX;
                character.Y = currentY;

                currentX += character.Width;

                if (maxSize < character.Height)
                {
                    this.Height = maxSize = character.Height;
                }

                this.Height = character.Height;

                character.Draw(window, context);
            }

            this.graphics = window.CreateGraphics();
            this.graphics.DrawRectangle(new Pen(this.Color, 1),
                                        new Rectangle(new Point(this.X, this.Y), new Size(this.Width, this.Height)));
        }
示例#3
0
        public override void Draw(Form window, GlyphContext context)
        {
            this.graphics = window.CreateGraphics();
            this.graphics.DrawRectangle(new Pen(this.color, 5), new Rectangle(point, size));

            foreach (var glyph in this.glyphs)
            {
                glyph.Draw(window, context);
            }
        }
示例#4
0
 public override void Insert(Glyph glyph, GlyphContext context)
 {
     if (glyph is Row)
     {
         this.glyphs.Add(glyph);
     }
     else
     {
         throw new ArgumentException("В столбец допустимо помещать только строки - Row");
     }
 }
示例#5
0
 public override void Insert(Glyph glyph, GlyphContext context)
 {
     if (glyph is Column)
     {
         if (this.glyphs.Count < 2)
         {
             this.glyphs.Add(glyph);
         }
     }
     else
     {
         throw new ArgumentException("В страницу допустимо помещать только столбцы - Column ");
     }
 }
示例#6
0
        public override void Insert(Glyph glyph, GlyphContext context)
        {
            if (glyph is Character)
            {
                if (this.actualWidthRow + glyph.Width > this.Width)
                {
                    throw new ArgumentOutOfRangeException("Помещаемый символ не помещается в строку.");
                }

                this.actualWidthRow += glyph.Width;
                this.glyphs.Add(glyph);
            }
            else
            {
                throw new ArgumentException("В строку допустимо помещать только символы - Character");
            }
        }
示例#7
0
        public override void Draw(Form window, GlyphContext context)
        {
            int currentX = this.X + 5;
            int currentY = this.Y + 5;

            foreach (var row in this.glyphs)
            {
                row.X = currentX;
                row.Y = currentY;

                currentY += row.Height;

                row.Width = this.Width - 10;

                row.Draw(window, context);
            }

            this.graphics = window.CreateGraphics();
            this.graphics.DrawRectangle(new Pen(this.Color, 2),
                                        new Rectangle(new Point(this.X, this.Y), new Size(this.Width, this.Height)));
        }
示例#8
0
 public abstract void Next(GlyphContext context);
示例#9
0
 public abstract Font GetFont(GlyphContext context);
示例#10
0
 public abstract void First(GlyphContext context);
示例#11
0
 public abstract void Draw(Form window, GlyphContext context);
示例#12
0
 public abstract void SetFont(Font font, GlyphContext context);
示例#13
0
 public override bool IsDone(GlyphContext context)
 {
     throw new InvalidOperationException();
 }
示例#14
0
 public override void Remove(GlyphContext context)
 {
     throw new NotImplementedException();
 }
示例#15
0
 public override bool IsDone(GlyphContext context)
 {
     throw new NotImplementedException();
 }
示例#16
0
 public override Glyph Current(GlyphContext context)
 {
     throw new NotImplementedException();
 }
示例#17
0
 public abstract void Insert(Glyph glyph, GlyphContext context);
示例#18
0
 public override void SetFont(Font font, GlyphContext context)
 {
     this.context = context;
 }
示例#19
0
 public override void Remove(GlyphContext context)
 {
     throw new InvalidOperationException();
 }
示例#20
0
 public override void Insert(Glyph glyph, GlyphContext context)
 {
     throw new InvalidOperationException();
 }
示例#21
0
 public override Glyph Current(GlyphContext context)
 {
     throw new InvalidOperationException();
 }
示例#22
0
 public abstract bool IsDone(GlyphContext context);
示例#23
0
 public override void Draw(Form window, GlyphContext context)
 {
     this.graphics = window.CreateGraphics();
     this.graphics.DrawString(character, font, brush, this.X, this.Y);
 }
示例#24
0
 public abstract Glyph Current(GlyphContext context);
示例#25
0
 public override Font GetFont(GlyphContext context)
 {
     return(context.GetFont());
 }
示例#26
0
 public abstract void Remove(GlyphContext context);
示例#27
0
 public override void SetFont(Font font, GlyphContext context)
 {
     throw new NotImplementedException();
 }