2个回答
展开全部
private int startX = 550;
private bool isAdd = false;
public Form1()
{
InitializeComponent();
}
private void picShow_Paint(object sender, PaintEventArgs e)
{
if (isAdd) {
startX += 20;
if (startX > picShow.Width) {
isAdd = false;
}
} else {
if (startX < 0) {
isAdd = true;
}
startX -= 20;
}
e.Graphics.DrawImage(imageList1.Images[0], new Point(startX, 0));
}
private void timer1_Tick(object sender, EventArgs e)
{
picShow.Refresh();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 10;
timer1.Enabled = true;
}
这是以前写的,你把X和Y改一下不就行了?
private bool isAdd = false;
public Form1()
{
InitializeComponent();
}
private void picShow_Paint(object sender, PaintEventArgs e)
{
if (isAdd) {
startX += 20;
if (startX > picShow.Width) {
isAdd = false;
}
} else {
if (startX < 0) {
isAdd = true;
}
startX -= 20;
}
e.Graphics.DrawImage(imageList1.Images[0], new Point(startX, 0));
}
private void timer1_Tick(object sender, EventArgs e)
{
picShow.Refresh();
}
private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 10;
timer1.Enabled = true;
}
这是以前写的,你把X和Y改一下不就行了?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询