コード例 #1
0
        private void btngrddailytreatment_Click(object sender, EventArgs e)
        {
            Dgv_Expense.Show();
            chart_monthlyExpense.Hide();
            Dgv_Expense.Location = new Point(45, 51);
            Dgv_Expense.Size     = new Size(1312, 308);
            label2.Text          = 0.ToString();
            label2.Visible       = true;
            fill_grid();
            if (Dgv_ChartExpanse.Rows.Count < 1)
            {
                int x = (panel3.Size.Width - Lab_Msg.Size.Width) / 2;
                Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                Lab_Msg.Show();
            }
            else
            {
                Lab_Msg.Hide();
            }
            if (rad_Expanse.Checked)
            {
                Dgv_Expense.Columns["colAmountdr"].Visible = false;
                Dgv_Expense.Columns["CoAmountCr"].Visible  = true;
            }
            else if (rad_Income.Checked)
            {
                Dgv_Expense.Columns["CoAmountCr"].Visible  = false;
                Dgv_Expense.Columns["colAmountdr"].Visible = true;
            }
            else
            {
                Dgv_Expense.Columns["CoAmountCr"].Visible  = true;
                Dgv_Expense.Columns["colAmountdr"].Visible = true;
            }
            int count = Dgv_Expense.Rows.Count;

            label2.Text = count.ToString();
        }
コード例 #2
0
        private void btnselect_Click(object sender, EventArgs e)
        {
            var d1 = dateTimePickerdailytreatment1.Value.ToShortDateString();
            var d2 = dateTimePickerdailytreatment2.Value.ToShortDateString();

            if (Convert.ToDateTime(d1).Date > Convert.ToDateTime(d2).Date)
            {
                MessageBox.Show("From date should be less than two date");
                dateTimePickerdailytreatment1.Value = DateTime.Today;
                return;
            }
            fill_grid();
            if (Dgv_Expense.Visible)
            {
                if (Dgv_ChartExpanse.Rows.Count < 1)
                {
                    int x = (panel3.Size.Width - Lab_Msg.Size.Width) / 2;
                    Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                    Lab_Msg.Show();
                }
                else
                {
                    Lab_Msg.Hide();
                }
                if (rad_Expanse.Checked)
                {
                    Dgv_Expense.Columns["colAmountdr"].Visible = false;
                    Dgv_Expense.Columns["CoAmountCr"].Visible  = true;
                }
                else if (rad_Income.Checked)
                {
                    Dgv_Expense.Columns["CoAmountCr"].Visible  = false;
                    Dgv_Expense.Columns["colAmountdr"].Visible = true;
                }
                else
                {
                    Dgv_Expense.Columns["CoAmountCr"].Visible  = true;
                    Dgv_Expense.Columns["colAmountdr"].Visible = true;
                }
                int row = Dgv_Expense.Rows.Count;
                label2.Text = row.ToString();
                Dgv_Expense.Show();
                chart_monthlyExpense.Hide();
                btngrddailytreatment.Visible  = true;
                chart_monthlyExpense.Location = new Point(22, 50);
                chart_monthlyExpense.Size     = new Size(1306, 378);
            }
            else
            {
                Dgv_Expense.Hide();
                chart_monthlyExpense.Show();
                btngrddailytreatment.Visible  = true;
                chart_monthlyExpense.Location = new Point(22, 50);
                chart_monthlyExpense.Size     = new Size(1306, 378);
                this.Dgv_ChartExpanse.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.False;
                dateTimePickerdailytreatment1.MaxDate = DateTime.Now;
                dateTimePickerdailytreatment2.MaxDate = DateTime.Now;
                DateTime now  = DateTime.Now;
                DateTime date = new DateTime(now.Year, now.Month, 1);
                if (Dgv_ChartExpanse.Rows.Count < 1)
                {
                    int x = (panel3.Size.Width - Lab_Msg.Size.Width) / 2;
                    Lab_Msg.Location = new Point(x, Lab_Msg.Location.Y);
                    Lab_Msg.Show();
                }
                else
                {
                    Lab_Msg.Hide();
                }
            }
        }