- 爱易网页
-
C#教程
- C#怎么使图片随机循环 求解
日期:2014-05-17 浏览次数:20817 次
C#如何使图片随机循环 求解
C#如何使图片随机循环
代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace The_Name
{
public partial class FormGame : Form
{
public FormGame()
{
InitializeComponent();
}
int shu;
private void buttonKaiShi_Click(object sender, EventArgs e)
{
shu = SuiJi();
timer1.Start();
}
public int SuiJi()
{
int sui = 0;
Random random = new Random();
sui = random.Next(1,8);
return sui;
}
private void timer1_Tick(object sender, EventArgs e)
{
switch (shu)
{
case 1:
pictureBox1.Top += 1;
if ( pictureBox1.Top >= pldi.Height)
{
pictureBox1.Top = pldi.Top;
}
break;
case 2: