Пример #1
0
        private void DueDateGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                for (int i = 0; i < this.DueDateGridView.Rows.Count; i++)
                {
                    TerraScanTextAndImageCell FirstDueCell = (TerraScanTextAndImageCell)this.DueDateGridView[this.DueDatePostDetailsTable.FirstDueColumn.ColumnName, i];
                    FirstDueCell.ImagexLocation = 99;
                    FirstDueCell.ImageyLocation = 2;

                    TerraScanTextAndImageCell secondDueCell = (TerraScanTextAndImageCell)this.DueDateGridView[this.DueDatePostDetailsTable.SecondDueColumn.ColumnName, i];

                    secondDueCell.ImagexLocation = 99;
                    secondDueCell.ImageyLocation = 2;
                    if (e.RowIndex == i)
                    {
                        FirstDueCell.Image  = Properties.Resources.calendarImage;
                        secondDueCell.Image = Properties.Resources.calendarImage;
                    }
                    else
                    {
                        if (e.RowIndex >= 0)
                        {
                            FirstDueCell.Image  = ExtendedGraphics.GenerateImage(1, 1, Convert.ToInt32(this.DueDateGridView[this.DueDateGridView.Columns["FirstDue"].Index, e.RowIndex].InheritedStyle.BackColor.R), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.G), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.B));
                            secondDueCell.Image = ExtendedGraphics.GenerateImage(1, 1, Convert.ToInt32(this.DueDateGridView[this.DueDateGridView.Columns["SecondDue"].Index, e.RowIndex].InheritedStyle.BackColor.R), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.G), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.B));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm);
            }
        }
Пример #2
0
        private void DueDateGridView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            try
            {
                for (int i = 0; i < this.DueDateGridView.Rows.Count; i++)
                {
                    TerraScanTextAndImageCell FirstDueCell = (TerraScanTextAndImageCell)this.DueDateGridView[this.DueDatePostDetailsTable.FirstDueColumn.ColumnName, i];
                    FirstDueCell.ImagexLocation = 79;
                    FirstDueCell.ImageyLocation = 2;

                    TerraScanTextAndImageCell secondDueCell = (TerraScanTextAndImageCell)this.DueDateGridView[this.DueDatePostDetailsTable.SecondDueColumn.ColumnName, i];

                    secondDueCell.ImagexLocation = 79;
                    secondDueCell.ImageyLocation = 2;

                    if (e.RowIndex == i)
                    {
                        FirstDueCell.Image  = Properties.Resources.calendarImage;
                        secondDueCell.Image = Properties.Resources.calendarImage;
                    }
                    else
                    {
                        if (e.RowIndex >= 0)
                        {
                            FirstDueCell.Image  = ExtendedGraphics.GenerateImage(1, 1, Convert.ToInt32(this.DueDateGridView[this.DueDateGridView.Columns["FirstDue"].Index, e.RowIndex].InheritedStyle.BackColor.R), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.G), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.B));
                            secondDueCell.Image = ExtendedGraphics.GenerateImage(1, 1, Convert.ToInt32(this.DueDateGridView[this.DueDateGridView.Columns["SecondDue"].Index, e.RowIndex].InheritedStyle.BackColor.R), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.G), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.B));
                        }
                    }
                    if (!string.IsNullOrEmpty(this.DueDateGridView.Rows[i].Cells["IsFirstDueEditable"].Value.ToString()) && this.DueDateGridView.Rows[i].Cells["IsFirstDueEditable"].Value.Equals(0))
                    // if (!string.IsNullOrEmpty(this.DueDatePostDetailsTable.Rows[i]["IsFirstDueEditable"].ToString()) && this.DueDatePostDetailsTable.Rows[i]["IsFirstDueEditable"].Equals(0))
                    {
                        if (e.RowIndex == i)
                        {
                            FirstDueCell.Image = Properties.Resources.calendarImage_disable;
                            this.DueDateGridView.Rows[i].Cells["FirstDue"].ReadOnly = true;
                        }
                        else
                        {
                            if (e.RowIndex >= 0)
                            {
                                FirstDueCell.Image = ExtendedGraphics.GenerateImage(1, 1, Convert.ToInt32(this.DueDateGridView[this.DueDateGridView.Columns["FirstDue"].Index, e.RowIndex].InheritedStyle.BackColor.R), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.G), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.B));
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(this.DueDateGridView.Rows[i].Cells["IsSecondDueEditable"].Value.ToString()) && this.DueDateGridView.Rows[i].Cells["IsSecondDueEditable"].Value.Equals(0))
                    // if (!string.IsNullOrEmpty(this.DueDatePostDetailsTable.Rows[i]["IsSecondDueEditable"].ToString()) && this.DueDatePostDetailsTable.Rows[i]["IsSecondDueEditable"].Equals(0))
                    {
                        if (e.RowIndex == i)
                        {
                            this.DueDateGridView.Rows[i].Cells["SecondDue"].ReadOnly = true;
                            secondDueCell.Image = Properties.Resources.calendarImage_disable;
                        }
                        else
                        {
                            if (e.RowIndex >= 0)
                            {
                                secondDueCell.Image = ExtendedGraphics.GenerateImage(1, 1, Convert.ToInt32(this.DueDateGridView[this.DueDateGridView.Columns["FirstDue"].Index, e.RowIndex].InheritedStyle.BackColor.R), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.G), Convert.ToInt32(this.DueDateGridView[0, e.RowIndex].InheritedStyle.BackColor.B));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.CloseCurrentForm, this.ParentForm);
            }
        }