tijian_tieying/web/dccdc.Selfhelp/frm_video.cs

84 lines
2.6 KiB
C#
Raw Permalink Normal View History

2025-02-20 12:14:39 +08:00
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 dccdc.Selfhelp
{
public partial class frm_video : Form
{
public frm_video()
{
InitializeComponent();
}
bool _playing = false;
int t = 0;
// int i = 0;
//string[] vfiles = Directory.GetFiles("d:\\shipin");
VlcPlayer vlcp = new VlcPlayer(Application.StartupPath + "\\plugins");
int alltime = 0;
private void frm_video_Load(object sender, EventArgs e)
{
vlcp.SetRenderWindow((int)panel1.Handle);
string videofile = System.Configuration.ConfigurationManager.AppSettings["videofile"];
if (!string.IsNullOrEmpty(videofile))
{
if (System.IO.File.Exists(videofile))
{
if (videofile.ToLower().EndsWith("png"))
{
pictureBox1.Visible = true;
timer1.Enabled = false;
pictureBox1.Image = Image.FromFile(videofile);
}
else
{
string jingying = System.Configuration.ConfigurationManager.AppSettings["jingying"];
if (string.IsNullOrEmpty(jingying))
{
jingying = "false";
}
if (jingying == "true")
{
vlcp.SetVolume(0);// = true;
}
vlcp.SetVolume(30);
vlcp.PlayFile(videofile);
_playing = true;
alltime = (int)vlcp.ShiChang;
timer1.Enabled = true;
//axWindowsMediaPlayer1.fullScreen = true;
//axWindowsMediaPlayer1.settings.setMode("loop", true);
}
}
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (_playing == true)
{
//lbl_dqjh.Text = i + " " + t + " " + vlcp.ShiChang + " " + vlcp.GetPlayTime();
t++;
if (t >= alltime)
{
vlcp.PlayFile(System.Configuration.ConfigurationManager.AppSettings["videofile"]);
alltime = (int)vlcp.ShiChang;
t = 0;
}
}
}
}
}