private void ST_Click(object sender, RoutedEventArgs e) { int i; drawST myst = new drawST(); if (running_train != 0) { myst.Init_DrawTS(track_len, time); for (i = 0; i < running_train; i++) { myst.set_st(train[i].spacetime); myst.DrawTS(); } imgPic.Source = myst.Finish_DrawTS(); } }