真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

10.WinFor練習(xí)--自動(dòng)播放圖片小程序

namespace _10Picture和Timer小程序
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

創(chuàng)新互聯(lián)公司是一家專業(yè)提供連云港企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、H5技術(shù)、小程序制作等業(yè)務(wù)。10年已為連云港眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。

    private void Form1_Load(object sender, EventArgs e)
    {
        //程序加載時(shí)播放音樂
        SoundPlayer sp = new SoundPlayer();
        sp.SoundLocation = @"C:\Users\Administrator.USER-20180925HC\Desktop\1.wav";
        sp.Play();
        //程序運(yùn)行時(shí)加載圖片到picBox
        pictureBox1.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\1.jpg");
        pictureBox2.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\2.jpg");
        pictureBox3.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\3.jpg");
        pictureBox4.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\4.jpg");
        pictureBox5.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\5.jpg");
        pictureBox6.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\6.jpg");
        //圖片的顯示方式
        pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
        pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
        pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;
        pictureBox4.SizeMode = PictureBoxSizeMode.StretchImage;
        pictureBox5.SizeMode = PictureBoxSizeMode.StretchImage;
        pictureBox6.SizeMode = PictureBoxSizeMode.StretchImage;

    }
    string[] path = Directory.GetFiles(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic");

    Random r = new Random();
    private void timer1_Tick(object sender, EventArgs e)
    {
        //每隔一秒鐘換一張圖片

        //開始賦值
        pictureBox1.Image = Image.FromFile(path[r.Next(0,path.Length)]);
        pictureBox2.Image = Image.FromFile(path[r.Next(0, path.Length)]);
        pictureBox3.Image = Image.FromFile(path[r.Next(0, path.Length)]);
        pictureBox4.Image = Image.FromFile(path[r.Next(0, path.Length)]);
        pictureBox5.Image = Image.FromFile(path[r.Next(0, path.Length)]);
        pictureBox6.Image = Image.FromFile(path[r.Next(0, path.Length)]);
    }
}

}


當(dāng)前名稱:10.WinFor練習(xí)--自動(dòng)播放圖片小程序
文章鏈接:http://weahome.cn/article/ggjdos.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部