작은 이미지를 WinForms pictureBox
컨트롤에로드 한 다음 폼의 반대쪽으로 움직 이도록 애니메이션으로 만듭니다.C#의 이미지 이동
나는 이미지를로드하고 타이머를 사용하여 이미지를 이동 시켰지만, 실행할 때 응용 프로그램은 pictureBox
및 그 이미지의 최종 위치 만 보여줍니다.
이미지를 최종 위치로 부드럽게 전환하는 방법은 무엇입니까? 여기
내 코드는 지금까지 있습니다 :public partial class Form1 : Form
{
private int counter = 0;
void timer_Tick(object sender, EventArgs e)
{
counter++;
if (counter == 1)
{
pictureBox1.Show();
timer1.Stop();
counter = 0;
}
}
public Form1()
{
InitializeComponent();
timer1.Interval = 10;
timer1.Tick += new EventHandler(timer_Tick);
}
private void button1_Click(object sender, EventArgs e)
{
while(i<=100){
int x = pictureBox1.Location.X;
int y = pictureBox1.Location.Y;
pictureBox1.Location = new Point(x+25, y);
timer1.Start();
}
}
}
while (i <= 100) {'어디에 정의되어 있습니까? 루프는 제시된 코드에 따라 절대로 종료되지 않습니다. – Amy