예제 #1
0
 private void CanvasPanel_Paint(object sender, PaintEventArgs e)
 {
     _pen.Width = 2;
     _length    = int.Parse(lengthtxt.Text);
     _graphics  = CanvasPanel.CreateGraphics();
     for (int i = 0; i < int.Parse(linestxt.Text); i++)
     {
         Draw();
     }
 }
예제 #2
0
 public Form1()
 {
     InitializeComponent();
     g = CanvasPanel.CreateGraphics();
     g.SmoothingMode                  = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     pen                              = new Pen(Color.Black, 5);
     pen.StartCap                     = pen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
     state                            = State.DRAW;
     Curves                           = new BindingList <CurveAbstract>();
     curvesList.DataSource            = Curves;
     curvesList.DisplayMember         = "Name";
     pointsListBox.SelectionMode      = SelectionMode.MultiSimple;
     curveTypeSelectionBox.DataSource = System.Enum.GetValues(typeof(CurveType));
     curveTypeSelectionBox.SetSelected(0, true);
 }
예제 #3
0
        void Render()
        {
            Graphics g = null;
            Graphics Canvas;
            BufferedGraphicsContext rc;

            rc = BufferedGraphicsManager.Current;
            BufferedGraphics rg = null;

            g      = CanvasPanel.CreateGraphics();
            rg     = rc.Allocate(g, CanvasPanel.DisplayRectangle);
            Canvas = rg.Graphics;
            Canvas.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
            Canvas.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
            Canvas.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            Canvas.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.HighSpeed;
            Canvas.TextRenderingHint  = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;

            /////////////////
            /////////////////Drawing code here
            /////////////////

            Canvas.Clear(Color.Black);

            for (int i = 0; i < 128; i++)
            {
                Canvas.DrawLine(new Pen(Color.FromArgb(50, 50, 50)), i * 3, 0, i * 3, 128 * 3);
                Canvas.DrawLine(new Pen(Color.FromArgb(50, 50, 50)), 0, i * 3, 128 * 3, i * 3);
            }


            if (rg != null)
            {
                rg.Render(g);
            }

            if (rg != null)
            {
                //rg.Dispose();
            }
            if (g != null)
            {
                g.Dispose();
            }
        }
예제 #4
0
 public Form1()
 {
     InitializeComponent();
     Canvas = CanvasPanel.CreateGraphics();
 }
예제 #5
0
파일: Paint.cs 프로젝트: Yashkindjus/ISD.C
 public Paint()
 {
     InitializeComponent();
     graficsCreate = CanvasPanel.CreateGraphics();//allow program for painting
 }