Пример #1
0
 private void btnPreview_Click(object sender, EventArgs e)
 {
     using (var g = pnlPreview.CreateGraphics())
     {
         _stamp.Font = this.Font;
         int scale = Convert.ToInt32(Convert.ToDouble(pnlPreview.Width) / Convert.ToDouble(_stamp.Width));
         _stamp.Draw(g, scale, 0, 0);
     }
 }
Пример #2
0
        private void frmStamp_Paint(object sender, PaintEventArgs e)
        {
            const int gridSize = 50;

            var checkeredStamp = new Stamp(3, 2, new List <StampPoint>()
            {
                new StampPoint(0, 0, Color.DarkCyan),
                new StampPoint(1, 0, Color.OrangeRed),
                new StampPoint(0, 1, Color.OrangeRed),
                new StampPoint(1, 1, Color.DarkCyan),
                new StampPoint(2, 0, Color.DarkGoldenrod),
                new StampPoint(2, 1, Color.DarkKhaki)
            }, this.Font);

            for (int x = 0; x < 25; x += checkeredStamp.Width)
            {
                for (int y = 0; y < 25; y += checkeredStamp.Height)
                {
                    checkeredStamp.Draw(e.Graphics, gridSize, x, y);
                    Thread.Sleep(150);
                }
            }
        }