using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Vortex.Drawing;
using Piggy.Vortex;

namespace TestByZhaogw
{
    public partial class frmPiggyDrawTools : Form
    {
        public frmPiggyDrawTools()
        {
            InitializeComponent();
        }
        PiggyDrawer aa;

        private void Form1_Load(object sender, EventArgs e)
        {
            aa=PiggyDrawer.InitToUseD3D(pv, this, new onCanvasDraw(myDraw));
            aa.ClearColor = Color.FromArgb(0, Color.White);
            aa.StrokeIndex = 0;
        }
        private void myDraw(PiggyDrawer sender)
        {
            if (aa != null)
            {
                LineStyle ls = aa.getCurrentLineStyle(5);
                Canvas2D canvas = sender.TargetContext.Canvas;
                canvas.DrawLine(2, 8, 62, 8, ls, ColorU.Black);
            }
        }

        private void radioButton2_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.Clear((sender as Control).BackColor);
            Pen mp = new Pen(Color.Black, 1);
            e.Graphics.DrawEllipse(mp, e.ClipRectangle);
            //e.Graphics.DrawRectangle 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Bitmap tt = aa.TargetContext.Backbuffer.ToBitmap();
            tt.Save("c:\\tt"+numericUpDown1.Value+".bmp");
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            aa.StrokeIndex =(int) (sender as NumericUpDown).Value;
        }
    }
}
