예제 #1
0
        private void Button_Append_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                return;
            }

            Boolean           Found = false;
            FormatStringGroup NowformatStringGroup = Groups[rButton_Style];

            for (int i = 0; i < NowformatStringGroup.FormatStrings.Count; i++)
            {
                if (NowformatStringGroup.FormatStrings[i].ToString() == textBox1.Text)
                {
                    Found = true;
                    break;
                }
            }

            if (!Found)
            {
                FormatString fs = new FormatString();
                fs.FormatValue = textBox1.Text;
                fs.FormatStyle = rButton_Style;

                DepositoryReportFormat.UpdateReportFormats(fs);
                NowformatStringGroup.FormatStrings.Add(fs);
                lBox_FormatString.Items.Add(fs);
                tBox_FormatString.Text = lBox_FormatString.Items[0].ToString();
                textBox1.Text          = "";
            }
        }
예제 #2
0
        private void FormatStyleForm_Load(object sender, EventArgs e)
        {
            Groups = DepositoryReportFormat.InitReportFormats();

            //给每一类赋一个示例
            Groups[FormatStyle.General].Example         = "";
            Groups[FormatStyle.Number].Example          = "1234.56789";
            Groups[FormatStyle.Currency].Example        = "1234.56789";
            Groups[FormatStyle.Date].Example            = DateTime.Now.ToString();
            Groups[FormatStyle.Time].Example            = DateTime.Now.ToString();
            Groups[FormatStyle.Percent].Example         = "1234.56789";
            Groups[FormatStyle.ScientificCount].Example = "1234.56789";
            Groups[FormatStyle.Text].Example            = "";


            if (_FormatStyle == FormatStyle.General)
            {
                rButton_General.Checked = true;
            }
            else if (_FormatStyle == FormatStyle.Number)
            {
                rButton_Number.Checked = true;
            }
            else if (_FormatStyle == FormatStyle.Currency)
            {
                rButton_Currency.Checked = true;
            }
            else if (_FormatStyle == FormatStyle.Percent)
            {
                rButton_Percent.Checked = true;
            }
            else if (_FormatStyle == FormatStyle.Date)
            {
                rButton_Date.Checked = true;
            }
            else if (_FormatStyle == FormatStyle.Time)
            {
                rButton_Time.Checked = true;
            }
            else if (_FormatStyle == FormatStyle.ScientificCount)
            {
                rButton_ScientificCount.Checked = true;
            }
            else if (_FormatStyle == FormatStyle.Text)
            {
                rButton_Text.Checked = true;
            }

            ShowFormatString(_FormatStyle);

            foreach (FormatString String in lBox_FormatString.Items)
            {
                if (String.FormatValue.ToLower() == FormatString.ToLower())
                {
                    lBox_FormatString.SelectedIndex = lBox_FormatString.Items.IndexOf(String);
                    break;
                }
            }
        }
예제 #3
0
        private void Button_Delete_Click(object sender, EventArgs e)
        {
            FormatString      fs  = (FormatString)lBox_FormatString.SelectedItem;
            FormatStringGroup Fsg = Groups[rButton_Style];

            if (fs != null)
            {
                if (DialogResult.Yes == MessageBox.Show("确定删除格式串 ‘" + fs.FormatValue + "’ 吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
                {
                    DepositoryReportFormat.DeleteReportFormats(fs);
                    lBox_FormatString.Items.Remove(lBox_FormatString.SelectedItem);
                    Fsg.FormatStrings.Remove(fs);
                    if (lBox_FormatString.Items.Count > 0)
                    {
                        lBox_FormatString.SelectedIndex = 0;
                    }
                    else
                    {
                        tBox_FormatString.Text = "";
                    }
                }
            }
        }