惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Troy Hunt's Blog
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta
F
Full Disclosure
Recorded Future
Recorded Future
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
博客园_首页
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hacker News: Front Page
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
博客园 - 司徒正美
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
Help Net Security
Help Net Security
Cloudbric
Cloudbric
PCI Perspectives
PCI Perspectives
有赞技术团队
有赞技术团队
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
L
Lohrmann on Cybersecurity
量子位
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tailwind CSS Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
N
News and Events Feed by Topic
罗磊的独立博客
T
Threat Research - Cisco Blogs
Schneier on Security
Schneier on Security
T
Tor Project blog
IT之家
IT之家
M
MIT News - Artificial intelligence
S
Security @ Cisco Blogs
O
OpenAI News
AI
AI
S
Securelist
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
月光博客
月光博客
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题

博客园 - semye

input+select(multiple)实现下拉框输入值 简单的js分页脚本 - semye - 博客园 请问做个类似这样的网站多少钱 省份和城市 - semye - 博客园 客户端取用户控件中服务器控件的标识 VS2003调试很慢 enctype="multipart/form-data" 群发邮件太慢了! SQL SERVER “数组参数” WEB水晶报表部署笔记 写程序解智力题,help!!! 低级错误是怎样“炼”成的? SQL语句区分大小写问题 发送邮件 - semye - 博客园 JS事件大全 WinForm动态添加控件及其事件 公历转换为农历 简单水晶报表程序与安装部署文件制作 导数程序
WinForm程序实现滚动字幕与背景音乐
semye · 2007-04-03 · via 博客园 - semye

1.滚动字幕
用一个LABEL放在PANEL中,用一个TIMER来动态改变LABEL的LOCATION

 1            int xx = this.label1.Location.X;
 2            int yy = this.label1.Location.Y;
 3        private void timer1_Tick(object sender, System.EventArgs e)
 4        {
 5            if(this.label1.Location.Y+this.label1.Size.Height>0)
 6            {
 7                this.label1.Location = new System.Drawing.Point(this.label1.Location.X,this.label1.Location.Y-1);
 8            }

 9            else
10            {
11                this.label1.Location = new System.Drawing.Point(xx,yy);
12            }

13        }

14

2.背景音乐

1        private void StartPlayMusic()
2        {
3            Music.PlayMusic("\".\\music\\菊花台.mp3\"");
4        }

5

Music.cs

 1using   System;   
 2using   System.Runtime.InteropServices;   
 3    
 4namespace   TestWinProj 
 5{   
 6    internal   class   Music   
 7    {   
 8        [DllImport("winmm.dll")] 
 9        public static extern long PlaySound(String fileName,long a,long b);
10
11        [DllImport("winmm.dll")]
12        public static extern long mciSendString(string lpstrCommand,string lpstrReturnString,long length,long hwndcallback);
13        
14        /// <summary>
15        /// 播放音乐文件
16        /// </summary>
17        /// <param name="p_FileName">音乐文件名称</param>

18        public static void PlayMusic(string p_FileName)
19        {
20            try
21            {
22                mciSendString(@"close " +p_FileName ,"                                  ",0,0);
23                mciSendString(@"open " + p_FileName,"                                  ",0,0);
24                mciSendString(@"play " + p_FileName ,"                                  ",0,0);
25            }

26            catch
27            {
28            }

29        }

30        
31        /// <summary>
32        /// 停止当前音乐播放
33        /// </summary>
34        /// <param name="p_FileName">音乐文件名称</param>

35        public static void StopMusic(string p_FileName)
36        {
37            try
38            {
39                mciSendString(@"close " + p_FileName,"                                  ",0,0);
40            }

41            catch{}
42        }

43
44
45    }
   
46}
   
47
48