PDA

View Full Version : سوال: نحوه کار با progressBar



kh1387
پنج شنبه 22 بهمن 1388, 20:17 عصر
با سلام
من چطوری میتونم progressBar رو طراحی کنم که هنگام کپی فایلها بگه چقدرش کپی شده؟
مر30

debugger
پنج شنبه 22 بهمن 1388, 21:27 عصر
File.Copy(openFileDialog1.FileName,textBox2.Text);
byte[] b = File.ReadAllBytes(openFileDialog1.FileName);
progressBar1.Maximum = b.Length;
progressBar1.Minimum = 0;
FileStream s = newFileStream(textBox2.Text, FileMode.Append);
for (int i = 0; i < b.Length; i++)
{
progressBar1.Value = progressBar1.Value + 1;
s.WriteByte(b[i]);
}