How to create a trafic program
-
Hi i was just wondoring if anyone knows how to create a trafic program with the 3 lights and cars going from left to right, right to left, up down and down up in c# i did it in java it is easy but how can we do it in c# thx /\|-||\/|/\|)
-
It also the same. You can take your java source code and a little bit changes then you can compile it using C#. The language is almost the same.
stancrm wrote:
It also the same
I know it is very similar but the thing is there are functions in java that i used that are not present in c# also i am not an expert in c# so for example i don't know how to represent the car as a moving object on the screen... thx /\|-||\/|/\|)
-
stancrm wrote:
It also the same
I know it is very similar but the thing is there are functions in java that i used that are not present in c# also i am not an expert in c# so for example i don't know how to represent the car as a moving object on the screen... thx /\|-||\/|/\|)
-
Halawlaws wrote:
for example i don't know how to represent the car as a moving object on the screen...
How did you represent a moving car on the screen in Java? Best, Jun
-
Jun Du wrote:
How did you represent a moving car on the screen in Java?
With frames do i have frames in c#? thx /\|-||\/|/\|)
-
stancrm wrote:
It also the same
I know it is very similar but the thing is there are functions in java that i used that are not present in c# also i am not an expert in c# so for example i don't know how to represent the car as a moving object on the screen... thx /\|-||\/|/\|)
If you create a new Windows Form, then use the event Paint.
private void Form1_Paint(object sender, PaintEventArgs e)
{
...
}Then write your code in this method. For example :
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Brushes.Black, 1), 0, 0, 50, 50);
}That code will draw a black line with width = 1, from (0,0) to (50,50)