Esempio n. 1
0
        //Temperary Function To Check Table
        private bool CheckTable(bool allowNonConflictDup, out bool nonConflict)
        {
            bool presult = true;

            nonConflict = true;
            IONameList.Clear();

            if (pDGV.Rows.Count == 0)
            {
                presult = false;
                return(presult);
            }

            if (allowNonConflictDup)
            {
                IONameList = (from DataGridViewRow ro in dgv.Rows
                              let s = ro.Cells["IOName"].Value as string
                                      where ValidStr(s)
                                      select s).ToList();
            }

            DataGridViewCellStyle style = new DataGridViewCellStyle();

            pDGV.DefaultCellStyle = style.Clone();

            foreach (DataGridViewRow row in pDGV.Rows)
            {
                if (!RegCheck(row) || !ConflictDuplicationCheck(row))
                {
                    style.BackColor = System.Drawing.Color.OrangeRed;
                    presult         = false;
                }
                else
                {
                    if (!NonConflictDuplicationCheck(row))
                    {
                        if (allowNonConflictDup)
                        {
                            style.BackColor = System.Drawing.Color.AliceBlue;
                            nonConflict     = false;
                        }
                        else
                        {
                            style.BackColor = System.Drawing.Color.OrangeRed;
                            presult         = false;
                        }
                    }
                    else
                    {
                        style.BackColor = System.Drawing.Color.White;
                    }
                }
                row.Cells["IOName"].Style = style.Clone();
            }
            return(presult);
        }
        private void InitializeDGVStyle()
        {
            DataGridViewCellStyle s = new DataGridViewCellStyle();

            dgvStyleDict = new Dictionary <styleEnum, DataGridViewCellStyle>();
            s.BackColor  = System.Drawing.Color.ForestGreen;
            dgvStyleDict.Add(styleEnum.Good, s.Clone());
            s.BackColor = System.Drawing.Color.OrangeRed;
            dgvStyleDict.Add(styleEnum.Nogood, s.Clone());
            s.BackColor = System.Drawing.Color.Goldenrod;
            dgvStyleDict.Add(styleEnum.Problem, s.Clone());
            s.BackColor = System.Drawing.Color.OrangeRed;
            dgvStyleDict.Add(styleEnum.Error, s.Clone());
            s.BackColor = System.Drawing.SystemColors.Control;
            dgvStyleDict.Add(styleEnum.None, s.Clone());
        }
Esempio n. 3
0
            protected override void Paint(
                Graphics graphics,
                Rectangle clipBounds,
                Rectangle cellBounds,
                int rowIndex,
                DataGridViewElementStates dataGridViewElementState,
                object value,
                object formattedValue,
                string errorText,
                DataGridViewCellStyle cellStyle,
                DataGridViewAdvancedBorderStyle advancedBorderStyle,
                DataGridViewPaintParts paintParts)
            {
                base.Paint(graphics, clipBounds, cellBounds, rowIndex, dataGridViewElementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, DataGridViewPaintParts.Background | DataGridViewPaintParts.SelectionBackground);
                DataGridViewCellStyle cellStyle1 = cellStyle.Clone();

                if (this.Selected || this.DataGridView.SelectedCells.Count != 0 && this.DataGridView.SelectedCells[0].RowIndex == this.RowIndex)
                {
                    graphics.FillRectangle((Brush) new SolidBrush(this.DataGridView.RowHeadersDefaultCellStyle.SelectionBackColor), cellBounds);
                    cellStyle1.ForeColor = Color.White;
                }
                cellBounds.X -= 33;
                base.Paint(graphics, clipBounds, cellBounds, rowIndex, dataGridViewElementState, value, formattedValue, errorText, cellStyle1, advancedBorderStyle, DataGridViewPaintParts.ContentForeground);
                cellBounds.X += 33;
                graphics.DrawLine(new Pen(Color.FromArgb(222, 222, 222)), cellBounds.X, cellBounds.Y + 17, cellBounds.X + cellBounds.Width, cellBounds.Y + 17);
            }
Esempio n. 4
0
 private void DgvTimesheet_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
 {
     for (int i = e.RowIndex; i < dgvTimesheet.Rows.Count; i++)
     {
         DataGridViewRow row = dgvTimesheet.Rows[i];
         row.DefaultCellStyle = defaultStyle.Clone();
         refreshTaskValues(row);
     }
 }
Esempio n. 5
0
        } // end method()

        private DataGridViewCellStyle overrideCellStyle(DataGridViewCellStyle dataGridViewCellStyle, FieldInfo fi)
        {
            DataGridViewCellStyle style = dataGridViewCellStyle.Clone();
            Type ftype = fi.FieldType;

            if (typeof(IList).IsAssignableFrom(ftype))
            {
                style.BackColor = Color.Gray;
                style.ForeColor = Color.White;
            }
            return(style);
        }
Esempio n. 6
0
        public void TestClone()
        {
            DataGridViewCellStyle style_aux = (DataGridViewCellStyle)style.Clone();

            Assert.AreEqual(style_aux, style, "#C1");
        }
Esempio n. 7
0
        void initializeDGV(DataGridView dgvToInit, string sName)
        {
            DataGridViewCellStyle sampleSummaryStyleMiddle = new DataGridViewCellStyle();
            DataGridViewCellStyle sampleSummaryStyleLeft;
            DataGridViewCellStyle sampleSummaryStyleRight;

            sampleSummaryStyleMiddle.Font      = new System.Drawing.Font(dgvToInit.Font, System.Drawing.FontStyle.Bold);
            sampleSummaryStyleMiddle.BackColor = System.Drawing.Color.LightYellow;

            sampleSummaryStyleLeft            = sampleSummaryStyleMiddle.Clone();
            sampleSummaryStyleLeft.Alignment  = DataGridViewContentAlignment.MiddleLeft;
            sampleSummaryStyleRight           = sampleSummaryStyleMiddle.Clone();
            sampleSummaryStyleRight.Alignment = DataGridViewContentAlignment.MiddleRight;
            //sampleSummaryStyleRight.
            dgvToInit.Columns.Add("run", "Run");
            dgvToInit.Columns.Add("sample", "Sample");
            dgvToInit.Columns.Add("ignore", "Ignore");
            dgvToInit.Columns.Add("median", "Median");
            dgvToInit.Columns.Add("mean", "Mean");
            dgvToInit.Columns.Add("label", "Label");
            dgvToInit.Columns.Add("path", "FullPath");
            dgvToInit.Columns["median"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvToInit.Columns["mean"].AutoSizeMode   = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvToInit.Columns["run"].AutoSizeMode    = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvToInit.Columns["sample"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvToInit.Columns["label"].AutoSizeMode  = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgvToInit.Columns["ignore"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            //dgvToInit.ReadOnly = true;
            dgvToInit.Columns["run"].ReadOnly    = true;
            dgvToInit.Columns["sample"].ReadOnly = true;
            dgvToInit.Columns["median"].ReadOnly = true;
            dgvToInit.Columns["mean"].ReadOnly   = true;
            dgvToInit.Columns["ignore"].ReadOnly = false;
            dgvToInit.Columns["label"].ReadOnly  = false;
            dgvToInit.Columns["path"].Visible    = false;

            dgvToInit.Columns["run"].SortMode    = DataGridViewColumnSortMode.NotSortable;
            dgvToInit.Columns["sample"].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvToInit.Columns["median"].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvToInit.Columns["mean"].SortMode   = DataGridViewColumnSortMode.NotSortable;
            dgvToInit.Columns["ignore"].SortMode = DataGridViewColumnSortMode.NotSortable;
            dgvToInit.Columns["label"].SortMode  = DataGridViewColumnSortMode.NotSortable;
            dgvToInit.Columns["path"].SortMode   = DataGridViewColumnSortMode.NotSortable;

            dgvToInit.CellValueChanged += new DataGridViewCellEventHandler(dgvToInit_CellValueChanged);
            //dgvToInit.Dock = DockStyle.Top;
            dgvToInit.AllowUserToAddRows    = false;
            dgvToInit.AllowUserToDeleteRows = false;
            dgvToInit.Rows.Add(new string[] { "[# of Runs:", "[Sample: " + sName + "]", "[ Mean:", "", "Map Label:", sName });

            dgvToInit.Rows[0].DefaultCellStyle            = sampleSummaryStyleMiddle;
            dgvToInit.Rows[0].Cells["ignore"].Style       = sampleSummaryStyleRight;
            dgvToInit.Rows[0].Cells["median"].Style       = sampleSummaryStyleLeft;
            dgvToInit.Rows[0].Cells["mean"].Style         = sampleSummaryStyleRight;
            dgvToInit.Rows[0].Cells["sample"].ToolTipText = "Double-click to Expand/Collapse";
            //dgvToInit.Rows[0].AdjustRowHeaderBorderStyle(new DataGridViewAdvancedBorderStyle()
            dgvToInit.CellDoubleClick += new DataGridViewCellEventHandler(dgv_CellDoubleClick);
            dgvHolder.Controls.Add(dgvToInit);
            inputDGVList.Add(dgvToInit);

            //if (inputDGVList.Count == 1)
        }
 /// <summary>Creates an exact copy of this <see cref="IDataGridViewCellStyle"></see>.</summary>
 /// <returns>A <see cref="IDataGridViewCellStyle"></see> that represents an exact copy of this cell style.</returns>
 public IDataGridViewCellStyle Clone()
 {
     return(new DataGridViewCellStyleVWG(_dataGridViewCellStyle.Clone()));
 }
Esempio n. 9
0
        public void Recolor(DataGridView lyricView)
        {
            Color SelectionForeColor = Color.DarkGray;
            Color LightColor         = Color.FromArgb(220, 230, 240);
            Color MediumColor        = Color.FromArgb(180, 190, 190);
            Color DarkColor          = Color.FromArgb(80, 110, 120);
            Color GreenColor         = Color.FromArgb(196, 239, 214);
            Color InsertColor        = Color.FromArgb(230, 232, 237);
            DataGridViewCellStyle defaultCellStyle = lyricView.DefaultCellStyle.Clone();

            defaultCellStyle.SelectionBackColor = Color.LightBlue;
            defaultCellStyle.SelectionForeColor = DarkColor;

            DataGridViewCellStyle darkCellStyle = defaultCellStyle.Clone();

            darkCellStyle.BackColor          = DarkColor;
            darkCellStyle.SelectionBackColor = DarkColor;
            darkCellStyle.SelectionForeColor = MediumColor;
            darkCellStyle.ForeColor          = MediumColor;

            DataGridViewCellStyle insertCellStyle = defaultCellStyle.Clone();

            insertCellStyle.BackColor          = InsertColor;
            insertCellStyle.SelectionBackColor = Color.LightSkyBlue;
            insertCellStyle.SelectionForeColor = DarkColor;

            DataGridViewCellStyle deleteCellStyle = defaultCellStyle.Clone();

            deleteCellStyle.ForeColor          = Color.DarkGray;
            deleteCellStyle.BackColor          = Color.LightGray;
            deleteCellStyle.SelectionBackColor = Color.DimGray;
            deleteCellStyle.SelectionForeColor = Color.LightGray;

            DataGridViewCellStyle lyricCellStyle = defaultCellStyle.Clone();

            lyricCellStyle.BackColor = GreenColor;

            lyricView.Columns[0].DefaultCellStyle = darkCellStyle;
            lyricView.DefaultCellStyle            = defaultCellStyle;

            for (int y = 0; y < lyricView.Rows.Count; y++)
            {
                Note note = Ust.Notes[y];
                if (note.Number == NumberManager.INSERT)
                {
                    for (int x = 1; x < 3; x++)
                    {
                        lyricView[x, y].Style = insertCellStyle;
                    }
                }
                if (note.IsRest)
                {
                    for (int x = 0; x < lyricView.Columns.Count; x++)
                    {
                        lyricView[x, y].Style = darkCellStyle;
                    }
                }
                if (note.Number == NumberManager.DELETE)
                {
                    for (int x = 1; x < lyricView.Columns.Count; x++)
                    {
                        lyricView[x, y].Style = deleteCellStyle;
                    }
                }
                //if (note.Syllable != null)
                lyricView[3, y].Style = darkCellStyle;
                //if (note.WordName != null)
                lyricView[4, y].Style = darkCellStyle;
            }
        }