110,538
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace dmshipin
{
public partial class Form1 : Form
{
int i = 1500;
public Form1()
{
InitializeComponent();
}
private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = @"d:\h1.mp4";
//axWindowsMediaPlayer1.uiMode = "none";
}
private void timer1_Tick(object sender, EventArgs e)
{
System.Drawing.Size size = this.Size;
System.Drawing.Point point = this.Location;
int left = this.Left;
int width = this.Width;
if (i < 10)
{
i = width - 10;
}
else {
i = i - 5;
}
label1.Location = new Point(i, 40);
label1.BackColor = Color.Transparent;
label2.Location = new Point(i+10, 80);
label3.Location = new Point(i-5, 120);
label4.Location = new Point(i+20, 160);
////画出的文字
Graphics g = this.CreateGraphics();
Font font = new Font("华为宋体", 20);
//Point一样,只是值是浮点类型
PointF point1 = new PointF(150, 150);
g.DrawString("我是画出来的文字!!!", font, Brushes.Coral, point1);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace dmshipin
{
public partial class Form1 : Form
{
//GDI画图的双缓存设定
private BufferedGraphics graphBuffer = null;
int danmuweizhi_x = 1500;//默认弹幕起始位置
public Form1()
{
InitializeComponent();
}
private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
{
axWindowsMediaPlayer1.currentPlaylist = axWindowsMediaPlayer1.newPlaylist("播放列表", "");
//遍历打开的集合
string[] bofangliebiao = new string[] { @"d:\h3.mp4", @"d:\h2.mp4", @"d:\h1.mp4" };
foreach (string fn in bofangliebiao)
{
//添加播放列表
axWindowsMediaPlayer1.currentPlaylist.appendItem(axWindowsMediaPlayer1.newMedia(fn));
}
//GDI画图的双缓存设定
graphBuffer = (new BufferedGraphicsContext()).Allocate(axWindowsMediaPlayer1.CreateGraphics(), axWindowsMediaPlayer1.DisplayRectangle);
//循环播放
axWindowsMediaPlayer1.settings.setMode("loop", true);
//播放
axWindowsMediaPlayer1.Ctlcontrols.play();
}
private void timer1_Tick(object sender, EventArgs e)
{
System.Drawing.Size size = this.Size;
System.Drawing.Point point = this.Location;
int left = this.Left;
int width = this.Width;
if (danmuweizhi_x < -400)
{
danmuweizhi_x = width - 10;
}
else {
danmuweizhi_x = danmuweizhi_x - 1;
}
label1.Location = new Point(danmuweizhi_x, 40);
label2.Location = new Point(danmuweizhi_x + 10, 80);
label3.Location = new Point(danmuweizhi_x - 5, 120);
label4.Location = new Point(danmuweizhi_x + 20, 160);
////画出的文字
//Graphics danmu = axWindowsMediaPlayer1.CreateGraphics();
//GDI画图的双缓存设定
Graphics danmu = graphBuffer.Graphics;
Font font = new Font("黑体", 24);
//Point一样,只是值是浮点类型
PointF point1 = new PointF(danmuweizhi_x + 10, 250);
SolidBrush grayBrush = new SolidBrush(Color.Gray);
danmu.DrawString("我是画出来的文字!!!", font, Brushes.White, point1);
}
}
}
public partial class Form1 : Form
{
private BufferedGraphics graphBuffer = null;
private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = @"d:\h1.mp4";
graphBuffer = (new BufferedGraphicsContext()).Allocate(axWindowsMediaPlayer1.CreateGraphics(), axWindowsMediaPlayer1.DisplayRectangle);
}
private void timer1_Tick(object sender, EventArgs e)
{
Graphics g = graphBuffer.Graphics;
...
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace dmshipin
{
public partial class Form1 : Form
{
int i = 1500;
public Form1()
{
InitializeComponent();
}
private void axWindowsMediaPlayer1_Enter(object sender, EventArgs e)
{
axWindowsMediaPlayer1.URL = @"d:\h1.mp4";
//axWindowsMediaPlayer1.uiMode = "none";
}
private void timer1_Tick(object sender, EventArgs e)
{
System.Drawing.Size size = this.Size;
System.Drawing.Point point = this.Location;
int left = this.Left;
int width = this.Width;
if (i < 10)
{
i = width - 10;
}
else {
i = i - 1;
}
label1.Location = new Point(i, 40);
label1.BackColor = Color.Transparent;
label2.Location = new Point(i+10, 80);
label3.Location = new Point(i-5, 120);
label4.Location = new Point(i+20, 160);
////画出的文字
Graphics g = this.CreateGraphics();
Graphics danmu = axWindowsMediaPlayer1.CreateGraphics();
Font font = new Font("黑体", 20);
//Point一样,只是值是浮点类型
PointF point1 = new PointF(i+10, 250);
SolidBrush grayBrush = new SolidBrush(Color.Gray);
danmu.DrawString("我是画出来的文字!!!", font, Brushes.White, point1);
}
}
}