public MyForm() { InitializeComponent(); Graphics g = PaintPanel.CreateGraphics(); gl = new GraphicsLibrary(g.GetHdc());//new GraphicsLibrary(e.Graphics.GetHdc()); }
public Form1() { InitializeComponent(); Graphics g = PaintPanel.CreateGraphics(); DoubleBuffered = true; bmp = new Bitmap(PaintPanel.Width, PaintPanel.Height); line = new LineDrawer(bmp); rectangle = new RectangleDrawer(bmp); square = new SquareDrawer(bmp); triangle = new TriangleDrawer(bmp); ellipse = new EllipseDrawer(bmp); circle = new CircleDrawer(bmp); }
private void RandomButton_Click(object sender, EventArgs e) { PaintPanel.Refresh(); Random r = new Random(); graph = PaintPanel.CreateGraphics(); pointlist = new PointList(Convert.ToInt32(PointsLabel.Text)); classes = new ClassesData[0]; for (int i = 0; i < pointlist.pointcollection.Length; i++) { Point p = new Point(r.Next(1, 200), r.Next(1, 300)); pointlist.pointcollection[i] = (new PointData(p.X, p.Y, Color.Red)); } foreach (PointData pd in pointlist.pointcollection) { graph.DrawRectangle(new Pen(pd.color), pd.point.X, pd.point.Y, 2, 2); } }