7日站立會議
public Form每月結算()
{
InitializeComponent();
}
bool flag = false;
private void Form每月結算_Load(object sender, EventArgs e)
{
Bitmap b = new Bitmap(300, 20);
Graphics g = Graphics.FromImage(b);
g.DrawLine(new Pen(Brushes.Blue), new Point(5, 5), new Point(300, 5));
pictureBox1.Image = b;
}
private void button1_Click(object sender, EventArgs e)
{
Test._f.Close();
}
private void button2_Click(object sender, EventArgs e)
{
Form功能選擇 f = new Form功能選擇();
f.Show();
flag = true;
this.Close();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string dp = Test.path + @"\文字資料\" + numericUpDown1.Value.ToString() + @"年" + comboBox1.Text;
if (Directory.Exists(dp))
{
string[] fArr = Directory.GetFiles(dp);
label3.Text = "這個月共記錄了" + fArr.Length + "天的賬目";
foreach (string f in fArr)
{
string str=null;
using (FileStream fs = new FileStream(f, FileMode.OpenOrCreate, FileAccess.Read))
{
byte[] buffer = new byte[1024 * 1024 * 5];
int x = fs.Read(buffer, 0, buffer.Length);
str = Encoding.Default.GetString(buffer, 0, x);
}
if (str == null)
{
continue;
}
else
{
string[] sArr = str.Split(Environment.NewLine.ToCharArray());
foreach (string s in sArr)
{
if (s == "")
{
continue;
}
string[] text = s.Split('\t');
if (text[1] == "日常用品")
{
textBox1.Text = (Convert.ToDouble(textBox1.Text) + Convert.ToDouble(text[2])).ToString();
}
else if (text[1] == "學習用品")
{
textBox2.Text = (Convert.ToDouble(textBox2.Text) + Convert.ToDouble(text[2])).ToString();
}
else if (text[1] == "話費")
{
textBox3.Text = (Convert.ToDouble(textBox3.Text) + Convert.ToDouble(text[2])).ToString();
}
else if (text[1] == "飲食")
{
textBox4.Text = (Convert.ToDouble(textBox4.Text) + Convert.ToDouble(text[2])).ToString();
}
else if (text[1] == "衣服")
{
textBox5.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(text[2])).ToString();
}
else if (text[1] == "其他")
{
textBox6.Text = (Convert.ToDouble(textBox6.Text) + Convert.ToDouble(text[2])).ToString();
}
}
}
}