本文介绍了通过检查扩展范围来播放Flash和图片广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有Windows应用程序,可以在同一位置以一定间隔播放Flash和图像
在下面的代码中,我正在使用特定的目录和特定的文件(例如Top_1.swf和图像D:\ .....),但我想使用
我必须通过查找其扩展名来播放Flash或图片,而不是默认提供其名称.
i have windows application which plays flash and images in certain intervals at the same location
here in the below code i am using the particular directory and particular file(like Top_1.swf and for image D:\.....)but i want like
i have to play flash or picture by finding their extension not by default giving their name.
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 Demo_Flash
{
public partial class Form1 : Form
{
Timer timer1 = new Timer();
Timer timer2 = new Timer();
Timer timer3 = new Timer();
int i = 0;
int j = 0;
public Form1()
{
InitializeComponent();
i = 1;
j = 1;
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = (1000) * 10;
timer1.Enabled = true;
timer1.Start();
timer2.Tick += new EventHandler(timer2_Tick);
timer2.Interval = (1000) * 10;
timer2.Enabled = false;
timer3.Tick += new EventHandler(timer3_Tick);
timer3.Interval = (1000) * 5;
timer3.Enabled = true;
timer3.Start();
}
void timer1_Tick(object sender, EventArgs e)
{
pictureBox1.Visible = false;
pictureBox1.Enabled = false;
axShockwaveFlash1.Visible = true;
axShockwaveFlash1.BringToFront();
if (i == 1)
{
string path = System.Environment.CurrentDirectory;
path += @"\Top_1.swf";
axShockwaveFlash1.LoadMovie(0, path);
axShockwaveFlash1.Play();
i++;
}
else if (i == 2)
{
string path = System.Environment.CurrentDirectory;
path += @"\Top_2.swf";
axShockwaveFlash1.LoadMovie(0, path);
axShockwaveFlash1.Play();
i--;
}
}
void timer2_Tick(object sender, EventArgs e)
{
axShockwaveFlash1.Visible = false;
pictureBox1.BringToFront();
pictureBox1.Visible = true;
pictureBox1.Enabled = true;
if (j == 1)
{
pictureBox1.Image = Image.FromFile("D:/Project Source/Experimented/Bulk Sms/ProjectSms/ProjectSms/bin/Debug/Advertisement1_1.jpg");
j++;
}
else if (j == 2)
{
pictureBox1.Image = Image.FromFile("D:/Project Source/Experimented/Bulk Sms/ProjectSms/ProjectSms/bin/Debug/Advertisement2_1.jpg");
j--;
}
}
void timer3_Tick(object sender, EventArgs e)
{
timer3.Enabled = false;
timer2.Enabled = true;
timer2.Start();
}
}
}
任何人都知道答案,请帮助我
[edit]在标签内格式化-标签对未格式化的输入不起作用![/edit]
any one know the answer please help me
[edit]Formatted within tags - tags do nothing with unformatted input![/edit]
推荐答案
这篇关于通过检查扩展范围来播放Flash和图片广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!