日期:2014-05-18 浏览次数:21111 次
Cursor = Cursors.WaitCursor; //进度条FROM waiting wt = new waiting(); new Thread(new ThreadStart(delegate { if (!wt.IsDisposed && !wt.Disposing) wt.ShowDialog(); })).Start(); /// ///数据查询过程 /// if (wt.InvokeRequired) { wt.Invoke(new MethodInvoker(delegate { wt.Dispose(); })); } else { wt.Dispose(); wt.Close(); } Cursor = Cursors.Arrow;
------解决方案--------------------
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading; namespace WindowsApplication2 { public delegate void CloseFunction(); public partial class Form1 : Form { public Form1() { InitializeComponent(); this.progressBar1.Maximum = 100; this.thisTimer = new System.Windows.Forms.Timer(); this.thisTimer.Interval = 1000; this.thisTimer.Tick += new EventHandler(thisTimer_Tick); this.thisTimer.Start(); Thread thd = new Thread(new ParameterizedThreadStart(GetData )); thd.Start(); } void thisTimer_Tick(object sender, EventArgs e) { progressBar1.PerformStep(); } private void GetData( object o ) { Thread.Sleep(100); thisTimer.Stop(); this.Invoke( new CloseFunction( this.Close ) ); } private System.Windows.Forms.Timer thisTimer; } } using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication2 { public partial class MainFrame : Form { public MainFrame() { Form1 form1 = new Form1(); form1.ShowDialog(); InitializeComponent(); } private void MainFrame_Load(object sender, EventArgs e) { string mPath=Application.StartupPath; axWindowsMediaPlayer1.URL = mPath + "\\Voice\\1.mp3"; axWindowsMediaPlayer1.Ctlcontrols.play(); } } }
------解决方案--------------------
lz是想调用系统默认复制文件的那个对话框吧,2个文件夹之间一张纸飞来飞去的那个。。。。
C#调用系统的复制、移动、删除文件对话框
http://blog.csdn.net/herojams/archive/2009/01/05/3715247.aspx
------解决方案--------------------
对于一个进度条,无碍乎是最小最大值,以及当前值等一些重要的属性,至于方法,用得较多的是PerformStep()和PerformClick()之类的。代码如下: private void btnRun_Click(object sender, EventArgs e) { btnRun.Enabled = false; if (txtBoxTarget.Text.Equals(String.Empty) || txtBoxTimes.Text.Equals(String.Empty)) { MessageBox.Show("请输入连接的URL和连接次数!", "提示",