コード例 #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Opening coin or money file...";
            openFileDialog.Filter = "Coin file(*.coi)|*.coi|Money file(*.mon)|*.mon";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (Path.GetExtension(openFileDialog.FileName) == ".coi")
                {
                    CoinForm coinForm = new CoinForm(this, openFileDialog.FileName);
                    if (coinForm.fileName != null)
                    {
                        coinForm.Show();
                    }
                    else
                    {
                        coinForm.Dispose();
                    }
                }
                else if (Path.GetExtension(openFileDialog.FileName) == ".mon")
                {
                    MoneyForm moneyForm = new MoneyForm(this, openFileDialog.FileName);
                    if (moneyForm.fileName != null)
                    {
                        moneyForm.Show();
                    }
                    else
                    {
                        moneyForm.Dispose();
                    }
                }
            }
        }
コード例 #2
0
        private void newCoinFOrmToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CoinForm coinForm = new CoinForm();

            coinForm.MdiParent = this;
            coinForm.Show();
        }