s00014405

s00014405

  • NA
  • 24
  • 0

Flickering drawing on image / slight trail also..

Nov 18 2004 6:10 AM
Am a newbie using GDI+ and am trying to do an Air Hockey game. I want to draw on a PictureBox control - the following code does so... but the puck and paddle i draw keep flickering, and also there is a slight trail when i move around the paddle with the mouse. Any suggestions on how to resolve this? private void frmTable_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { gameDraw(); } private void gameDraw() { Graphics g = picTable.CreateGraphics(); SolidBrush redBrush = new SolidBrush(Color.FromArgb(255,50,50)); Pen bluePen = new Pen( Color.Blue, 2 ); Pen blackPen = new Pen( Color.Black, 2 ); g.FillEllipse( redBrush, paddle_x, paddle_y, 32, 32 ); g.DrawEllipse( bluePen, paddle_x, paddle_y, 32, 32 ); g.FillEllipse( redBrush, puck_x, puck_y, 32, 32 ); g.DrawEllipse( blackPen, puck_x, puck_y, 32, 32 ); redBrush.Dispose(); bluePen.Dispose(); blackPen.Dispose(); }

Answers (4)