Hello
I want to draw every second a new Rectangle, just beside the other one.
I've got a timer which tick's every second. In this method, I want to draw a Rectangle. But I've already have a function to draw a Rectangle. So I want just to call the function in the Tick.
public void timer1_Tick(object sender, System.EventArgs e)
{
lbTime.Visible = true;
TimeSpan span = DateTime.Now.Subtract(da);
this.lbTime.Text = span.Hours.ToString() + " : " + span.Minutes.ToString() + " : " + span.Seconds.ToString();
lblTimerStap.Visible = true;
TimeSpan spant = DateTime.Now.Subtract(da);
this.lblTimerStap.Text = spant.Hours.ToString() + " : " + spant.Minutes.ToString() + " : " + spant.Seconds.ToString();
pictureBox1.Invalidate();
if (cont == true)
{
pictureBox1.Paint();
}
PictureBox1.Paint() gives a fault --> The event 'System.Windows.Forms.Control.Paint' can only appear on the left hand side of += or -=
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
String algoritme = cmbSchedule.SelectedItem.ToString();
int burstlengte = Controller.GetInstance(ProcessList).KeuzeVanAlgoritme(algoritme);
g.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(20, 20, burstlengte * 2, 100);
Pen redPen = new Pen(Color.Red, 3);
g.FillRectangle(Brushes.Red, 25, 20, burstlengte * 2, 100);
}
Does anyone knows how I got to call the PictureBox1.paint into the Tick?