Exemplo n.º 1
0
        private void frmStampEditor_Load(object sender, EventArgs e)
        {
            FillColorOptions();

            _stamp = new Stamp(1, 1, new List <StampPoint>()
            {
                new StampPoint(0, 0, Color.AliceBlue)
            }, this.Font);
            InitDataBinding(_stamp);
        }
Exemplo n.º 2
0
        private void tsbOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = fileDialogFilter;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _stamp = JsonFile.Load <Stamp>(dlg.FileName);
                InitDataBinding(_stamp);
            }
        }
Exemplo n.º 3
0
        private void InitDataBinding(Stamp stamp)
        {
            tbWidth.DataBindings.Clear();
            tbHeight.DataBindings.Clear();

            tbWidth.DataBindings.Add(new Binding("Text", stamp, "Width"));
            tbHeight.DataBindings.Add(new Binding("Text", stamp, "Height"));

            BindingList <StampPoint> points = new BindingList <StampPoint>(stamp.Fill);

            points.AllowNew     = true;
            points.AllowEdit    = true;
            dgvStamp.DataSource = points;
        }
Exemplo n.º 4
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);
                }
            }
        }