通过检查扩展范围来播放Flash和图片广告 [英] Play flash and picture ads by checking the extention

查看:51
本文介绍了通过检查扩展范围来播放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]

推荐答案

您说我有Windows应用程序",然后说"'任何人都知道答案'.我认为这意味着您希望拥有这样的应用程序.检查扩展很简单,请查看System.IO.Path类以查找仅获取扩展的方法.除非安装了Flash并且使用了Web浏览器控件,否则SWF文件没有内置支持,在这种情况下,无法跟踪文件需要多长时间.显然,显示图像是微不足道的.
You said ''I have Windows application'', then you say ''anyone know the answer''. I assume this means you WANT to have such an app. Checking extensions is trivial, look at the System.IO.Path class to find a method to get just an extension. There is no in build support for SWF files, unless Flash is installed and you use the web browser control, in which case there''s no way to track how long the file goes for. Showing an image is trivial, obviously.


这篇关于通过检查扩展范围来播放Flash和图片广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆