Winform Windows Media Player 简易播放器 分类: WinForm 2014-07-31 20:12 589人阅读 评论(0) 收藏
新手上路,高手勿进!
窗体设计:
实现效果:
实现代码:
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;
using System.Data.SqlClient;
using System.Runtime.InteropServices;
using System.IO;
using System.Collections;
using System.Media;
namespace Music {
public partial class LenMusic : Form {
public LenMusic() {
InitializeComponent();
}
#region
string strMusic = "";//音乐路径
string strImage = "";//图片路径
string strGeci = "";//歌词路径
ArrayList musicNameList = new ArrayList();//所有文件的名称
ArrayList imageNameList = new ArrayList();//所有图片的名称
ArrayList geciNameList = new ArrayList();//所有歌词路径
int allcount = 0;//所有条数
int nowcount = 0;//当前歌曲的索引
string abcMusic = "";//记录当前播放的歌曲名称,用于单曲循环播放
bool MaxOrNo = false;//判断一个窗体是否是最大化
int txtn = 0;//txt文件的行数
#endregion
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filepath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retval, int size, string filePath);
private string strFilePath = Application.StartupPath + "\\Path.ini";//获取INI文件路径
private string strSec = "";//INI文件名
/// <summary>
/// 自定义读取INI文件中的内容方法
/// </summary>
/// <param name="Section">键</param>
/// <param name="key">值</param>
/// <returns></returns>
private string ContentValue(string Section, string key) {
StringBuilder temp = new StringBuilder(1024);
GetPrivateProfileString(Section, key, "", temp, 1024, strFilePath);
return temp.ToString();
}
#region Load事件
private void LenMusic_Load(object sender, EventArgs e) {
//设置层显示
grbSet.Visible = false;
pnlMusic.Visible = true;
//歌词路径赋值
strGeci = Application.StartupPath + "\\txtGeCi";
#region 获取歌曲名称,图片名称,歌词名称
if (File.Exists(strFilePath))//读取时先要判读INI文件是否存在
{
strSec = Path.GetFileNameWithoutExtension(strFilePath);
strMusic = ContentValue(strSec, "musicPath");
strImage = ContentValue(strSec, "imagePath");
//设置路径的默认值
string XiangDuiPath = System.AppDomain.CurrentDomain.BaseDirectory;
if (strMusic.Equals("")) {
strMusic = XiangDuiPath + @"MP3";
}
if (strImage.Equals("")) {
strImage = XiangDuiPath + @"images";
}
} else {
MessageBox.Show("INI文件不存在");
return;
}
// 取得指定路径下所有符合条件的文件
string[] strFiles = Directory.GetFiles(strMusic, "*.*");
// 取得指定路径下所有目录
//string[] strDirs = Directory.GetDirectories(strMusic);
//foreach (string lujing in strDirs) {
// musicList.Add(lujing);
//}
foreach (string name in strFiles) {
musicNameList.Add(GetFileName(name));
}
//获取指定目录下所有图片的名称
string[] strFilesImage = Directory.GetFiles(strImage, "*.*");
foreach (string name in strFilesImage) {
imageNameList.Add(GetFileName(name));
}
//获取指定目录下所有歌词的名称
string[] strFilesGeci = Directory.GetFiles(strGeci, "*.*");
foreach (string name in strFilesGeci) {
geciNameList.Add(GetFileName(name));
}
#endregion
#region ListView设置
listViewAll.GridLines = true;
listViewAll.FullRowSelect = true;
listViewAll.View = View.Details;//使用哪一个视图
listViewAll.Scrollable = false;
listViewAll.MultiSelect = false;
listViewAll.HeaderStyle = ColumnHeaderStyle.Clickable;
listViewAll.Columns.Add("序号", 40, HorizontalAlignment.Right);
listViewAll.Columns.Add("歌曲", 173, HorizontalAlignment.Left);
//设置行高
ImageList list = new ImageList();
list.ImageSize = new Size(1, 30);
listViewAll.SmallImageList = list;
//加载ListView数据
for (int i = 0; i < musicNameList.Count; i++) {
ListViewItem lvi = new ListViewItem();
lvi.SubItems.Clear();
lvi.Text = (i + 1).ToString();//序号列
lvi.SubItems.Add(musicNameList[i].ToString());//歌曲名称
listViewAll.Items.Add(lvi);
}
#endregion
#region 歌曲默认为第一首
try {
//歌曲默认为第一首
labName.Text = musicNameList[0].ToString();
} catch {
labName.Text = "歌曲名称";
}
#endregion
//歌曲总数
allcount = musicNameList.Count;
//设置模式
this.axWindowsMediaPlayer1.uiMode = "None";
#region 声音加载
this.tbVoice.Minimum = 0;//声音最小值
this.tbVoice.Maximum = 100;//声音最大值
//设置值
this.tbVoice.Value = axWindowsMediaPlayer1.settings.volume;
#endregion
#region 透明 设置
#region 设置pnlFontScoll
this.pnlMusic.SendToBack();//将背景图片放到最下面
this.pnlFontScoll.BackColor = Color.Transparent;//将Panel设为透明
this.pnlFontScoll.Parent = this.pnlMusic;//将panel父控件设为背景图片控件
this.pnlFontScoll.BringToFront();//将panel放在前面
#endregion
#region 歌词透明,歌词字体设置
//透明Label
this.pbPicture.SendToBack();
this.labGeci.BackColor = Color.Transparent;
this.labGeci.Parent = this.pbPicture;
this.labGeci.BringToFront();
//设置字体和颜色
this.labGeci.ForeColor = Color.Yellow;
this.labGeci.Font = new Font("华文行楷", 14);
#endregion
#region 透明层 设置picturebox
this.pbPicture.SendToBack();//将背景图片放到最下面
this.pnlTouMing.BackColor = Color.Transparent;//将Panel设为透明
this.pnlTouMing.Parent = this.pbPicture;//将panel父控件设为背景图片控件
this.pnlTouMing.BringToFront();//将panel放在前面
#endregion
//listViewAll 不支持背景色透明
#endregion
}
#endregion
#region 获取文件名称
public static string GetFileName(String path) {
if (path.Contains("\\")) {
string[] arr = path.Split('\\');
return arr[arr.Length - 1];
} else {
string[] arr = path.Split('/');
return arr[arr.Length - 1];
}
}
#endregion
#region 系统设置
private void pbSet_Click(object sender, EventArgs e) {
pnlMusic.Visible = false;
grbSet.Visible = true;
//从INI文件中读取数据
if (File.Exists(strFilePath))//读取时先要判读INI文件是否存在
{
strSec = Path.GetFileNameWithoutExtension(strFilePath);
txtMusicPath.Text = ContentValue(strSec, "musicPath");
txtImagePath.Text = ContentValue(strSec, "imagePath");
} else {
MessageBox.Show("INI文件不存在");
return;
}
}
//打开音乐路径
private void btnMusicPath_Click(object sender, EventArgs e) {
OpenFileDialog open = new OpenFileDialog();
open.Title = "请选择音乐文件!";
if (open.ShowDialog() == DialogResult.OK) {
txtMusicPath2.Text = open.FileName;
}
}
private void btnMusicPath_Click_1(object sender, EventArgs e) {
fbdMusic.Description = "请选择音乐文件!";
if (fbdMusic.ShowDialog() == DialogResult.OK) {
txtMusicPath.Text = fbdMusic.SelectedPath;
}
}
//打开音乐图片路径
private void btnImagePath_Click(object sender, EventArgs e) {
//fbdImages.t
fbdImages.Description = "选择的图片将在播放音乐时作为背景图片!";
if (fbdImages.ShowDialog() == DialogResult.OK) {
txtImagePath.Text = fbdImages.SelectedPath;
}
}
//保存,成功则自动关闭
private void btnSave_Click(object sender, EventArgs e) {
if (txtMusicPath.Text.Trim().Equals("")) {
MessageBox.Show("音乐路径不能为空!");
return;
}
if (txtImagePath.Text.Trim().Equals("")) {
MessageBox.Show("图片路径不能为空!");
return;
}
//StreamWriter sw = new StreamWriter(System.AppDomain.CurrentDomain + "\\Path.ini",true);
//sw.WriteLine(txtMusicPath.Text);
//sw.WriteLine(txtImagePath.Text);
//sw.Flush();
//sw.Close();
try {
strSec = Path.GetFileNameWithoutExtension(strFilePath);
WritePrivateProfileString(strSec, "musicPath", txtMusicPath.Text.Trim(), strFilePath);
WritePrivateProfileString(strSec, "imagePath", txtImagePath.Text.Trim(), strFilePath);
MessageBox.Show("保存成功!");
grbSet.Visible = false;
pnlMusic.Visible = true;
} catch (Exception ex) {
MessageBox.Show(ex.Message);
return;
}
}
//返回主界面
private void btnReturn_Click(object sender, EventArgs e) {
grbSet.Visible = false;
pnlMusic.Visible = true;
}
#endregion
#region 从列表中读取选中第一列的值,最上面显示歌曲名称
private void listViewAll_SelectedIndexChanged(object sender, EventArgs e) {
if (listViewAll.SelectedIndices != null && listViewAll.SelectedIndices.Count > 0) {
ListView.SelectedIndexCollection c = listViewAll.SelectedIndices;
string suoyin = listViewAll.Items[c[0]].Text;
nowcount = Convert.ToInt32(suoyin) - 1;
//改变歌曲名称
labName.Text = musicNameList[Convert.ToInt32(suoyin) - 1].ToString();
try {
//显示图片
pbPicture.Image = new Bitmap(strImage + "\\" + imageNameList[Convert.ToInt32(suoyin) - 1].ToString());
ReadTXT(labGeci);
} catch (Exception) {
}
}
}
#endregion
#region Listview 双击事件,播放音乐
private void listViewAll_DoubleClick(object sender, EventArgs e) {
axWindowsMediaPlayer1.URL = strMusic + "\\" + labName.Text;
axWindowsMediaPlayer1.Ctlcontrols.play();
//歌词
ReadTXT(labGeci);
}
#endregion
#region 播放/暂停
private void btnStop_Click(object sender, EventArgs e) {
try {
#region SoundPlayer 只可以播放波形文件(.wav格式)
//System.Media.SoundPlayer sp=new System.Media.SoundPlayer();
////SoundPlayer sp = new SoundPlayer();
//sp.SoundLocation = strMusic +"\\"+ labName.Text;
//sp.Load();
//sp.Play();
#endregion
if (btnStart.Text == ">") {
if (radOneYes.Checked == true) {
axWindowsMediaPlayer1.URL = strMusic + "\\" + abcMusic;
} else {
//播放
axWindowsMediaPlayer1.URL = strMusic + "\\" + labName.Text;
}
//记录播放位置
if (tbMusic.Value != 0) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = tbMusic.Value;
}
axWindowsMediaPlayer1.Ctlcontrols.play();
//歌词
ReadTXT(labGeci);
timerGeci.Enabled = true;
timer1.Enabled = true;
btnStart.Text = "||";
//透明层显示
pnlTouMing.Visible = false;
#region 一些属性
//string Duration = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("Duration");//持续时间(秒)
//string Title = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("Title");//媒体标题
//string Author = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("Author");//艺术家
//string Copyright = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("Copyright");//版权信息
//string Description = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("Description");//媒体内容描述
//string FileSize = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("FileSize");//文件大小
//string FileType = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("FileType");//文件类型
//string sourceURL = this.axWindowsMediaPlayer1.currentMedia.getItemInfo("sourceURL");//原始地址
//MessageBox.Show("持续时间:" + Duration + "||" + "媒体标题:" + Title + "||" + "艺术家:" + Author + "||" + "版权信息:" + Copyright + "||" + "媒体内容描述:" + Description + "||" + "文件大小:" + FileSize + "||" + "文件类型:" + FileType + "||" + "原始地址:" + sourceURL);
#endregion
return;
}
if (btnStart.Text == "||") {
//暂停
axWindowsMediaPlayer1.Ctlcontrols.pause();
timerGeci.Enabled = false;
timer1.Enabled = false;
btnStart.Text = ">";
//透明层显示
pnlTouMing.Visible = true;
return;
}
} catch (Exception ex) {
MessageBox.Show(ex.Message);
return;
}
}
#endregion
#region 上一曲
private void btnUp_Click(object sender, EventArgs e) {
for (int i = 0; i < allcount; i++) {
if (musicNameList[i].ToString() == labName.Text) {
nowcount = i;
}
}
//当前行所有大于0,则上一曲的索引最新为0
if (nowcount > 0) {
labName.Text = musicNameList[nowcount - 1].ToString();
//显示图片
pbPicture.Image = new Bitmap(strImage + "\\" + imageNameList[nowcount - 1].ToString());
//显示歌词
ReadTXT(labGeci);
axWindowsMediaPlayer1.URL = strMusic + "\\" + labName.Text;
axWindowsMediaPlayer1.Ctlcontrols.play();
//歌词
ReadTXT(labGeci);
} else {
return;
}
}
#endregion
#region 下一曲
private void btnNext_Click(object sender, EventArgs e) {
for (int i = 0; i < allcount; i++) {
if (musicNameList[i].ToString() == labName.Text) {
nowcount = i;
}
}
if (nowcount < allcount - 1) {
labName.Text = musicNameList[nowcount + 1].ToString();
//显示图片
pbPicture.Image = new Bitmap(strImage + "\\" + imageNameList[nowcount + 1].ToString());
//显示歌词
ReadTXT(labGeci);
axWindowsMediaPlayer1.URL = strMusic + "\\" + labName.Text;
axWindowsMediaPlayer1.Ctlcontrols.play();
//歌词
ReadTXT(labGeci);
} else {
return;
}
}
#endregion
#region 停止
private void btnStop_Click_1(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.stop();
// axWindowsMediaPlayer1.URL = strMusic + "\\" + labName.Text;
btnStart.Text = ">";
tbMusic.Value = 0;
labDateNow.Text = "00:00";
}
#endregion
#region 播放进度条
//进度条
private void timer1_Tick(object sender, EventArgs e) {
//axWindowsMediaPlayer1.URL = strMusic + "\\" + labName.Text;
if (axWindowsMediaPlayer1.currentMedia != null) {
tbMusic.Maximum = Convert.ToInt32(axWindowsMediaPlayer1.currentMedia.duration);
tbMusic.Minimum = 0;
tbMusic.Value = Convert.ToInt32(axWindowsMediaPlayer1.Ctlcontrols.currentPosition);
//字符串类型的当前时间
labDateNow.Text = axWindowsMediaPlayer1.Ctlcontrols.currentPositionString.ToString();
//字符串类型的时长
labDateAll.Text = axWindowsMediaPlayer1.currentMedia.durationString.ToString();
}
//是否循环播放
if (chkXunHuan.Checked == true) {//判断是单曲循环还是多曲循环
if (radOneYes.Checked == true) {//单曲循环
//如果进度条到达最大位置,则设置为最小值
if (tbMusic.Value == 0) {
btnStart.Text = ">";
btnStart.PerformClick();
}
} else { //多曲循环
//如果进度条到达最大位置,并且这一曲不是最好一曲就播放下一曲
if (tbMusic.Value == tbMusic.Maximum && axWindowsMediaPlayer1.currentMedia.getItemInfo("Title") != musicNameList[musicNameList.Count - 1].ToString()) {
btnNext.PerformClick();
}
}
}
}
#endregion
#region 改变音量的大小
private void tbVoice_Scroll(object sender, EventArgs e) {
this.axWindowsMediaPlayer1.settings.volume = this.tbVoice.Value;
}
#endregion
#region 快进、快退
//快进,卡
private void btnUpup_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.fastReverse();
}
//快退
private void btnNextnext_Click(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.fastForward();
}
#endregion
#region 改变播放进度
private void tbMusic_Scroll(object sender, EventArgs e) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = tbMusic.Value;
//this.axWindowsMediaPlayer1.currentMedia.setItemInfo("volume", 60);
}
#endregion
#region 点击声音按钮,音量是否显示
private void pbVoice_Click(object sender, EventArgs e) {
if (tbVoice.Visible == false) {
tbVoice.Visible = true;
return;
}
if (tbVoice.Visible == true) {
tbVoice.Visible = false;
return;
}
}
#endregion
#region 歌曲名称滚动字幕
private void timerFont_Tick(object sender, EventArgs e) {
labName.Left = labName.Left - 3;
if (labName.Right < 0) {
labName.Left = pnlFontScoll.Width;
}
}
#endregion
#region 单曲循环、多曲循环 显示
private void chkXunHuan_CheckedChanged(object sender, EventArgs e) {
if (chkXunHuan.Checked == true) {
pnlXunHuan.Visible = true;
return;
} else {
pnlXunHuan.Visible = false;
return;
}
}
private void chkXunHuan_MouseMove(object sender, MouseEventArgs e) {
if (chkXunHuan.Checked == true) {
pnlXunHuan.Visible = true;
return;
}
}
private void pnlXunHuan_MouseMove(object sender, MouseEventArgs e) {
if (chkXunHuan.Checked == true) {
int a = MouseInPanel(pnlXunHuan);
if (a == 1) {
pnlXunHuan.Visible = true;
} else {
pnlXunHuan.Visible = false;
}
}
}
#region 判断鼠标位置是否在一个层上
private int MouseInPanel(Panel panel) {
// 当前的屏幕除任务栏外的工作域大小
// this.Width = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
// this.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
// 当前的屏幕包括任务栏的工作域大小
// this.Width=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
// this.Height=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
// Cursor.Position.X;//鼠标的坐标,相对于屏幕
// Cursor.Position.Y;
int kuan = pnlMusic.Width;
int gao = pnlMusic.Height;
int x = Cursor.Position.X - (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width-kuan) / 2;
int y = Cursor.Position.Y - (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height-gao) / 2;
int px = panel.Location.X;//panel位置
int py = panel.Location.Y;
int pw = panel.Width;//panel宽和高
int ph = panel.Height;
if (x > px && y > py && x < px + pw && y < py + ph) {
return 1;
} else {
return 0;
}
}
#endregion
//获取窗体鼠标的位置,但是不执行
private void LenMusic_MouseMove(object sender, MouseEventArgs e) {
//mx = e.X;
//my = e.Y;
//label2.Text = e.X + "," + e.Y;
//mx = MousePosition.X - this.Width;
//my = MousePosition.Y - this.Height;
}
#endregion
#region 单曲被选中,把这首歌的名称赋值给一个变量
private void radOneYes_CheckedChanged(object sender, EventArgs e) {
if (radOneYes.Checked == true) {
abcMusic = labName.Text;
}
}
#endregion
//待解决问题,选中单曲循环时,会自动播放
#region 点击透明层上的按钮 播放
private void pbStart_Click(object sender, EventArgs e) {
if (btnStart.Text == ">") {
if (radOneYes.Checked == true) {
axWindowsMediaPlayer1.URL = strMusic + "\\" + abcMusic;
} else {
//播放
axWindowsMediaPlayer1.URL = strMusic + "\\" + labName.Text;
}
//记录播放位置
if (tbMusic.Value != 0) {
axWindowsMediaPlayer1.Ctlcontrols.currentPosition = tbMusic.Value;
}
axWindowsMediaPlayer1.Ctlcontrols.play();
timer1.Enabled = true;
btnStart.Text = "||";
//透明层显示
pnlTouMing.Visible = false;
return;
}
if (btnStart.Text == "||") {
//暂停
axWindowsMediaPlayer1.Ctlcontrols.pause();
timer1.Enabled = false;
btnStart.Text = ">";
//透明层显示
pnlTouMing.Visible = false;
}
return;
}
#endregion
#region 点击显示、关闭透明层
private void pbPicture_Click(object sender, EventArgs e) {
if (pnlTouMing.Visible == true) {
pnlTouMing.Visible = false;
} else {
if (btnStart.Text == ">") {
pbStart.Image = new Bitmap(Application.StartupPath + "\\image\\start.png");
} else {
pbStart.Image = new Bitmap(Application.StartupPath + "\\image\\start2.png");
}
pnlTouMing.Visible = true;
}
}
#endregion
#region 双击图片铺满屏幕、双击铺满窗体
private void pbPicture_DoubleClick(object sender, EventArgs e) {
#region 双击图片铺满窗体(设置窗体层的背景图片),效果不好
//pnlMusic.BringToFront();
//pnlMusic.BackgroundImage = System.Drawing.Image.FromFile(strImage+"\\" + imageNameList[nowcount].ToString());
////设置背景图片自动适应
//pnlMusic.BackgroundImageLayout = ImageLayout.Stretch;
#endregion
#region 双击,图片全屏
if (MaxOrNo == false) {//不是最大化
//把窗体设置为全屏
this.WindowState = FormWindowState.Maximized;
pnlMusic.Dock = System.Windows.Forms.DockStyle.Fill; //设置层的格式为充满
pbPicture.Parent = this.pnlMusic; //设置图片的父容器为层
pbPicture.Location = new System.Drawing.Point(0, 0);//把pbPicture的坐标设置为(0,0)
pbPicture.BringToFront(); //把pbPicture设置为顶层
//设置图片的宽和高
pbPicture.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
pbPicture.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
//设置播放按钮的位置
pnlTouMing.Location = new System.Drawing.Point(pbPicture.Width / 2, pbPicture.Height / 2 - 300);
MaxOrNo = true;//改变状态
} else { //是最大化
//this.WindowState = FormWindowState.Normal;
//pbPicture = pb;
//pnlMusic.SendToBack();
//pnlMusic.Dock = System.Windows.Forms.DockStyle.None;
MaxOrNo = false;//改变状态
}
#endregion
}
#endregion
#region 是否显示歌词
private void chkGeCi_CheckedChanged(object sender, EventArgs e) {
if (chkGeCi.Checked == true) {
labGeci.Visible = true;
timerGeci.Enabled = true;
} else {
labGeci.Visible = false;
timerGeci.Enabled = false;
}
}
#endregion
#region 读取TXT 文件
private void ReadTXT(Label lab) {
txtn = 0;//每次读取txt时,清空上一个TXT的行数
string strTxtAll = "";
string abc = strGeci + "\\" + geciNameList[nowcount].ToString();
FileStream fs = new FileStream(abc, FileMode.Open, FileAccess.Read, FileShare.None);
StreamReader sr = new StreamReader(fs, Encoding.GetEncoding("GB2312"));
string line = sr.ReadLine();
strTxtAll = line + "\r\n";
for (int ac = 0; line != null; ac++) {
line = sr.ReadLine();
txtn++;
strTxtAll += line + "\r\n";
}
lab.Text = strTxtAll;
lab.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
sr.Close();
fs.Close();
}
#endregion
#region 歌词滚动
private void timerGeci_Tick(object sender, EventArgs e) {
//获取步长
//int n = 0;//步长
//if (axWindowsMediaPlayer1.currentMedia != null) {
// double nAll = axWindowsMediaPlayer1.currentMedia.duration; //获取当前歌曲的时长
// ReadTXT(labGeci);//给Label赋值
// //计算时是以毫秒为单位的 Interval=1000;
// n = Convert.ToInt32(labGeci.Height / nAll);
// //MessageBox.Show(labGeci.Height + "," + nAll.ToString());
// return;
//}
//滚动
labGeci.Top = labGeci.Top - 3;
if (labGeci.Bottom < 0) {
labGeci.Top = pbPicture.Width;
}
}
#endregion
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
Winform Windows Media Player 简易播放器 分类: WinForm 2014-07-31 20:12 589人阅读 评论(0) 收藏的更多相关文章
- Dijkstra with priority queue 分类: ACM TYPE 2015-07-23 20:12 4人阅读 评论(0) 收藏
POJ 1511 Invitation Cards(单源最短路,优先队列优化的Dijkstra) //================================================= ...
- bzoj 1041 圆上的整点 分类: Brush Mode 2014-11-11 20:15 80人阅读 评论(0) 收藏
这里先只考虑x,y都大于0的情况 如果x^2+y^2=r^2,则(r-x)(r+x)=y*y 令d=gcd(r-x,r+x),r-x=d*u^2,r+x=d*v^2,显然有gcd(u,v)=1且u&l ...
- Poj 2528 Mayor's posters 分类: Brush Mode 2014-07-23 09:12 84人阅读 评论(0) 收藏
Mayor's posters Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 40570 Accepted: 11798 ...
- Ubuntu 命令行下快速打开各类文件 分类: ubuntu shell 2014-11-18 20:06 210人阅读 评论(0) 收藏
xdg-open 命令可以用来在Ubuntu下快速打开各类文件. 下面是从 manual 文档里截取的内容: 可以知道,该命令的功能是在图形界面下按照用户的平时习惯打开各类文件,甚至是链接. 这样,我 ...
- House Robber 分类: leetcode 算法 2015-07-09 20:53 2人阅读 评论(0) 收藏
DP 对于第i个状态(房子),有两种选择:偷(rob).不偷(not rob) 递推公式为: f(i)=max⎧⎩⎨⎪⎪{f(i−1)+vali,f(i−2)+vali,robi−1==0robi−1 ...
- Eclipse和MyEclipse的区别 分类: 编程工具 2015-07-18 11:12 23人阅读 评论(0) 收藏
今天,在一个Q群里有人问Eclipse和MyEclipse的区别.虽然对于知道的人来说答案很简单,但是对于不知道的人来说就很难,很多问题也都是这样的,会者不难,难者不会. 其实,网上搜搜答案就挺多的, ...
- 解决ORA-29857:表空间中存在域索引和/或次级对象 & ORA-01940:无法删除当前连接的用户问题 分类: oracle sde 2015-07-30 20:13 8人阅读 评论(0) 收藏
今天ArcGIS的SDE发生了一点小故障,导致系统表丢失,所以需要重建一下SDE数据库,在删除SDE用户和所在的表空间过程中遇到下面两个ORA错误,解决方法如下: 1)删除表空间时报错:ORA-298 ...
- 彩色模型 分类: 图像处理 Matlab 2015-01-08 20:43 364人阅读 评论(0) 收藏
彩色模型(又称彩色空间或彩色系统)是描述色彩的一种方法,本质上,彩色模型就是坐标系统和子空间的规范,系统中的每种颜色由单个点来表示.下面介绍两种最常用的彩色模型. 一.RGB彩色模型: RGB模型是最 ...
- Tenegrad评价函数 分类: 图像处理 Opencv 2014-11-12 20:46 488人阅读 评论(0) 收藏
Tenegrad函数式一种常用的图像清晰度评价函数,是一种基于梯度的函数. 在图像处理中,一般认为对焦好的图像具有更尖锐的边缘,故具有更大的梯度函数值. Tenegrad函数使用Sobel算子提取水平 ...
随机推荐
- boost::xml——基本操作以及中文乱码解决方案 (续)
本博文主要想说明以下两点: 1.对于上一篇的<boost::xml——基本操作以及中文乱码解决方案>解释,这篇博文基本解决了正确输入输出中英文问题,但是好像还没有解决修改中文出现乱码的问题 ...
- 测试functional的bind以及相关功能
注:在VS2010 UPDATE1下测试通过 /*测试functional的bind以及相关功能*/ #include <iostream> #include <functional ...
- CentOS6.5使用本地光盘做yum源 (参考:http://www.jb51.net/os/RedHat/43343.html)
一.使用光盘做yum源安装软件 mkdir /media/CentOS #新建CentOS挂载目录 mount -t auto /dev/cdrom /media/CentOS #挂载CentOS光 ...
- webapp框架—学习AngularUI1(demo折腾)
angularUI下载地址:https://github.com/Clouda-team/BlendUI 下载解压后,demo在根目录 现在测试官网demo的使用 用浏览器打开mobile-angul ...
- TCP/IP笔记 应用层(2)——FTP
1. FTP(File Transfer Protocol) 文件传送协议 FTP 只提供文件传送的一些基本的服务,它使用 TCP 可靠的运输服务.FTP 的主要功能是减少或消除在不同操作系统下处理文 ...
- "System.Web" 中不存在类型或命名空间
System.Web”中不存在类型或命名空间名称script /找不到System.Web.Extensions.dll引用 添加引用就行了...“添加引用→.Net→System.Web.Ente ...
- Struts2技术内幕-----第七章
1)基于人机交互的请求--响应模式主要由哪三大要素构成? ①沟通协议-----人和机器都能够明白的数据通信格式 ②请求内容-----人通过某种机制向机器发起的数据请求 ③响应内 ...
- bzoj 1067: [SCOI2007]降雨量 模擬
1067: [SCOI2007]降雨量 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2010 Solved: 503[Submit][Status] ...
- 【LA2796】Concert Hall Scheduling(最大费用最大流)
Description You are appointed director of a famous concert hall, to save it from bankruptcy. The hal ...
- Android GradientDrawable类的详解,设置activity的背景颜色渐变效果
看到这个例子的标题RoundRects,我的第一感觉是介绍RoundRectShape, 打开例子看了代码却是使用GradientDrawable来实现的. GradientDrawable 支持使用 ...