Beispiel #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);
        }
Beispiel #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)));
        }
Beispiel #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);
            }
        }
Beispiel #4
0
 public override void Insert(Glyph glyph, GlyphContext context)
 {
     if (glyph is Row)
     {
         this.glyphs.Add(glyph);
     }
     else
     {
         throw new ArgumentException("В столбец допустимо помещать только строки - Row");
     }
 }
Beispiel #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 ");
     }
 }
Beispiel #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");
            }
        }
Beispiel #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)));
        }
Beispiel #8
0
 public abstract void Next(GlyphContext context);
Beispiel #9
0
 public abstract Font GetFont(GlyphContext context);
Beispiel #10
0
 public abstract void First(GlyphContext context);
Beispiel #11
0
 public abstract void Draw(Form window, GlyphContext context);
Beispiel #12
0
 public abstract void SetFont(Font font, GlyphContext context);
Beispiel #13
0
 public override bool IsDone(GlyphContext context)
 {
     throw new InvalidOperationException();
 }
Beispiel #14
0
 public override void Remove(GlyphContext context)
 {
     throw new NotImplementedException();
 }
Beispiel #15
0
 public override bool IsDone(GlyphContext context)
 {
     throw new NotImplementedException();
 }
Beispiel #16
0
 public override Glyph Current(GlyphContext context)
 {
     throw new NotImplementedException();
 }
Beispiel #17
0
 public abstract void Insert(Glyph glyph, GlyphContext context);
Beispiel #18
0
 public override void SetFont(Font font, GlyphContext context)
 {
     this.context = context;
 }
Beispiel #19
0
 public override void Remove(GlyphContext context)
 {
     throw new InvalidOperationException();
 }
Beispiel #20
0
 public override void Insert(Glyph glyph, GlyphContext context)
 {
     throw new InvalidOperationException();
 }
Beispiel #21
0
 public override Glyph Current(GlyphContext context)
 {
     throw new InvalidOperationException();
 }
Beispiel #22
0
 public abstract bool IsDone(GlyphContext context);
Beispiel #23
0
 public override void Draw(Form window, GlyphContext context)
 {
     this.graphics = window.CreateGraphics();
     this.graphics.DrawString(character, font, brush, this.X, this.Y);
 }
Beispiel #24
0
 public abstract Glyph Current(GlyphContext context);
Beispiel #25
0
 public override Font GetFont(GlyphContext context)
 {
     return(context.GetFont());
 }
Beispiel #26
0
 public abstract void Remove(GlyphContext context);
Beispiel #27
0
 public override void SetFont(Font font, GlyphContext context)
 {
     throw new NotImplementedException();
 }