Example #1
0
        public void SetData(int fixColumn, DataTable table)
        {
            m_FixColumnCount = fixColumn;
            int maxColumns = this.Columns.Count;

            for (int i = m_FixColumnCount; i < maxColumns; i++)
            {
                string columnName = "F" + (i - m_FixColumnCount).ToString();
                this.Columns.Remove(columnName);
            }

            for (int i = m_FixColumnCount; i < table.Columns.Count; i++)
            {
                string columnName = "F" + (i - m_FixColumnCount).ToString();

                DataGridViewTextBoxColumnEx ex = new DataGridViewTextBoxColumnEx();
                this.Columns.Add(ex);
                ex.Name                       = columnName;
                ex.DataPropertyName           = columnName;
                ex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            }



            this.DataSource = table;
        }
        /// <summary>
        /// 方法说明:初始化单元格
        /// 作    者:jason.tang
        /// 完成时间:2013-02-05
        /// </summary>
        /// <param name="listRows">行数</param>
        /// <param name="listColumns">列数</param>
        private void InitDataGridView(List <int> listRows, List <int> listColumns, DataGridView datagridview)
        {
            int index = 0;

            //增加列
            DataGridViewTextBoxColumnEx column = new DataGridViewTextBoxColumnEx();

            List <int> listColWidth  = new List <int>();
            List <int> listRowHeight = new List <int>();

            foreach (int i in listColumns)
            {
                column       = new DataGridViewTextBoxColumnEx();
                column.Width = i;
                if (index == listColumns.Count - 1)
                {
                    column.Width = i - 3;
                }
                datagridview.Columns.Insert(index, column);
                listColWidth.Add(column.Width);
                index++;
            }

            index = 0;
            //增加行
            foreach (int i in listRows)
            {
                datagridview.Rows.Insert(index, 1);
                index++;
            }

            //行高设定
            index = 0;
            foreach (DataGridViewRow row in datagridview.Rows)
            {
                if (index < listRows.Count)
                {
                    row.Height = listRows[index];
                }
                if (index == datagridview.Rows.Count - 1)
                {
                    row.Height = row.Height - 3;
                }
                listRowHeight.Add(row.Height);
                index++;
            }
        }
Example #3
0
        /// <summary>
        /// Create a DataGridView according by a Location and Name
        /// </summary>
        /// <param name="location">Locate of DataGridView in Client Panel's</param>
        /// <param name="Name">Name of DataGridView</param>
        /// <returns>Created DataGridView's</returns>
        private DataGridView Standard_dgv(Point location, string Name)
        {
            DataGridView          dgv = new DataGridView();
            DataGridViewCellStyle dataGridViewCellStyle1  = new DataGridViewCellStyle();
            DataGridViewCellStyle dataGridViewCellStyle2  = new DataGridViewCellStyle();
            DataGridViewCellStyle dataGridViewCellStyle3  = new DataGridViewCellStyle();
            DataGridViewCellStyle dataGridViewCellStyle10 = new DataGridViewCellStyle();

            dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleCenter;

            DataGridViewTextBoxColumnEx TimeSpans = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx SAT       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx SUN       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx MON       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx TUE       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx WED       = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx THUR      = new DataGridViewTextBoxColumnEx();
            DataGridViewTextBoxColumnEx FRI       = new DataGridViewTextBoxColumnEx();

            #region DataGridViewTextBoxColumnEx TimeSpans
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle2.Font      = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            TimeSpans.DefaultCellStyle       = dataGridViewCellStyle2;
            TimeSpans.Frozen      = true;
            TimeSpans.HeaderText  = "Time Span";
            TimeSpans.Name        = "TimeSpan";
            TimeSpans.ReadOnly    = true;
            TimeSpans.SortMode    = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            TimeSpans.ToolTipText = "Class Time in Days";
            #endregion

            #region DataGridViewTextBoxColumnEx SAT
            SAT.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            SAT.DefaultCellStyle = dataGridViewCellStyle3;
            SAT.FillWeight       = 90F;
            SAT.HeaderText       = "SAT";
            SAT.Name             = "SAT";
            SAT.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            #endregion

            #region DataGridViewTextBoxColumnEx SUN
            SUN.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            SUN.DefaultCellStyle = dataGridViewCellStyle3;
            SUN.FillWeight       = 90F;
            SUN.HeaderText       = "SUN";
            SUN.Name             = "SUN";
            SUN.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            #endregion

            #region DataGridViewTextBoxColumnEx MON
            MON.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            MON.DefaultCellStyle = dataGridViewCellStyle3;
            MON.FillWeight       = 90F;
            MON.HeaderText       = "MON";
            MON.Name             = "MON";
            MON.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            #endregion

            #region DataGridViewTextBoxColumnEx TUE
            TUE.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            TUE.DefaultCellStyle = dataGridViewCellStyle3;
            TUE.FillWeight       = 90F;
            TUE.HeaderText       = "TUE";
            TUE.Name             = "TUE";
            TUE.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            #endregion

            #region DataGridViewTextBoxColumnEx WED
            WED.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            WED.DefaultCellStyle = dataGridViewCellStyle3;
            WED.FillWeight       = 90F;
            WED.HeaderText       = "WED";
            WED.Name             = "WED";
            WED.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            #endregion

            #region DataGridViewTextBoxColumnEx THUR
            THUR.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            THUR.DefaultCellStyle = dataGridViewCellStyle3;
            THUR.FillWeight       = 90F;
            THUR.HeaderText       = "THUR";
            THUR.Name             = "THUR";
            THUR.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            #endregion

            #region DataGridViewTextBoxColumnEx FRI
            FRI.AutoSizeMode     = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            FRI.DefaultCellStyle = dataGridViewCellStyle3;
            FRI.FillWeight       = 90F;
            FRI.HeaderText       = "FRI";
            FRI.Name             = "FRI";
            FRI.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            #endregion

            //
            // Set Data for DataGridView dgv
            //
            #region Define DataGridView dgv Body's
            dgv.AllowUserToAddRows    = false;
            dgv.AllowUserToDeleteRows = false;
            dgv.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                               | System.Windows.Forms.AnchorStyles.Right)));
            dgv.BorderStyle                           = System.Windows.Forms.BorderStyle.Fixed3D;
            dgv.CellBorderStyle                       = System.Windows.Forms.DataGridViewCellBorderStyle.Sunken;
            dgv.ColumnHeadersBorderStyle              = System.Windows.Forms.DataGridViewHeaderBorderStyle.Sunken;
            dataGridViewCellStyle1.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle1.BackColor          = System.Drawing.SystemColors.Control;
            dataGridViewCellStyle1.Font               = new System.Drawing.Font("Times New Roman", 11.5F);
            dataGridViewCellStyle1.ForeColor          = System.Drawing.SystemColors.WindowText;
            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle1.WrapMode           = System.Windows.Forms.DataGridViewTriState.True;
            dgv.ColumnHeadersDefaultCellStyle         = dataGridViewCellStyle1;
            dgv.ColumnHeadersHeight                   = 40;
            dgv.ColumnHeadersHeightSizeMode           = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            dgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                TimeSpans,
                SAT,
                SUN,
                MON,
                TUE,
                WED,
                THUR,
                FRI
            });
            dataGridViewCellStyle10.Alignment          = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            dataGridViewCellStyle10.BackColor          = System.Drawing.SystemColors.Window;
            dataGridViewCellStyle10.Font               = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(178)));
            dataGridViewCellStyle10.ForeColor          = System.Drawing.SystemColors.ControlText;
            dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
            dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
            dataGridViewCellStyle10.WrapMode           = System.Windows.Forms.DataGridViewTriState.True;
            dgv.DefaultCellStyle        = dataGridViewCellStyle10;
            dgv.GridColor               = System.Drawing.SystemColors.ActiveCaption;
            dgv.Location                = location;
            dgv.Name                    = Name;
            dgv.RightToLeft             = System.Windows.Forms.RightToLeft.No;
            dgv.RowHeadersBorderStyle   = System.Windows.Forms.DataGridViewHeaderBorderStyle.Sunken;
            dgv.RowHeadersVisible       = false;
            dgv.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            dgv.RowTemplate.Height      = 35;
            dgv.RowTemplate.Resizable   = System.Windows.Forms.DataGridViewTriState.False;
            dgv.SelectionMode           = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
            dgv.Size                    = new System.Drawing.Size(748, 462);
            dgv.ReadOnly                = true;
            dgv.RightToLeft             = (CultureInfo.CurrentCulture.EnglishName == "Persian" ||
                                           CultureInfo.CurrentCulture.EnglishName == "Farsi") ?
                                          System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No;
            dgv.MultiSelect = false;
            #endregion
            //
            // Add TimeSlots Data (8 - 9 , 9 - 10 , 10 - 11 , ... , 19 - 20)
            //
            for (int i = 8; i < 20; i++)
            {
                dgv.Rows.Add(i.ToString() + " - " + (i + 1).ToString());
            }
            //
            // Clear any Selected
            dgv.ClearSelection();
            //
            // End
            return(dgv);
        }
Example #4
0
        /// <summary>
        /// 创建对应关系网格
        /// </summary>
        private void CreateGridOfRelation()
        {
            DataGridViewTextBoxColumn col;

            dgvRelation.Columns.Clear();

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "";
            col.Visible          = false;
            col.DataPropertyName = "NCMS_CODE";
            col.Name             = col.DataPropertyName;
            col.ReadOnly         = true;
            dgvRelation.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "";
            col.Visible          = false;
            col.DataPropertyName = "HOSPITAL_CODE";
            col.Name             = col.DataPropertyName;
            col.ReadOnly         = true;
            dgvRelation.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "状态";
            col.Visible          = false;
            col.DataPropertyName = "STATUS";
            col.Name             = col.DataPropertyName;
            col.ReadOnly         = true;
            dgvRelation.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "";
            col.Visible          = false;
            col.DataPropertyName = "TYPE";
            col.Name             = col.DataPropertyName;
            col.ReadOnly         = true;
            dgvRelation.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "审核状态";
            col.Visible          = false;
            col.DataPropertyName = "APPROVE_STATUS";
            col.Name             = col.DataPropertyName;
            col.ReadOnly         = true;
            dgvRelation.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "上传时间";
            col.Visible          = false;
            col.DataPropertyName = "UPLOAD_TIME";
            col.Name             = col.DataPropertyName;
            col.ReadOnly         = true;
            dgvRelation.Columns.Add(col);

            col                  = new DataGridViewTextBoxColumn();
            col.HeaderText       = "上传人";
            col.Visible          = false;
            col.DataPropertyName = "UPLOADER";
            col.Name             = col.DataPropertyName;
            col.ReadOnly         = true;
            dgvRelation.Columns.Add(col);

            if (_matchClass == HIS.Base_BLL.Enums.MatchClass.项目匹配)
            {
                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "新农合编码";
                col.Width            = 120;
                col.DataPropertyName = "ITEM_CODE";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "新农合项目名称";
                col.Width            = 250;
                col.DataPropertyName = "ITEM_NAME";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "单位";
                col.Width            = 70;
                col.DataPropertyName = "UNIT";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "";
                col.Visible          = false;
                col.DataPropertyName = "ITEMID";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "医院名称";
                col.Width            = 120;
                col.DataPropertyName = "ITEMNAME";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                col.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "单位";
                col.Width            = 70;
                col.DataPropertyName = "ITEM_UNIT";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "价格";
                col.Width            = 60;
                col.DataPropertyName = "PRICE";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);
            }
            else
            {
                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "新农合药品编码";
                col.Width            = 100;
                col.DataPropertyName = "DRUG_CODE";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "新农合药品别名";
                col.Width            = 150;
                col.DataPropertyName = "DRUG_ALIAS";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "新农合药品名称";
                col.Width            = 150;
                col.DataPropertyName = "DRUG_NAME";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "剂型";
                col.Width            = 50;
                col.DataPropertyName = "DRUG_FORM";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "";
                col.Visible          = false;
                col.DataPropertyName = "ITEMID";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "医院药品名称";
                col.Width            = 120;
                col.DataPropertyName = "ITEMNAME";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                col.AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "规格";
                col.Width            = 90;
                col.DataPropertyName = "STANDARD";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "单位";
                col.Width            = 50;
                col.DataPropertyName = "ITEM_UNIT";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "单价";
                col.Width            = 70;
                col.DataPropertyName = "PRICE";
                col.ReadOnly         = true;
                col.Name             = col.DataPropertyName;
                dgvRelation.Columns.Add(col);

                col                  = new DataGridViewTextBoxColumn();
                col.HeaderText       = "生产厂家";
                col.Width            = 100;
                col.DataPropertyName = "ADDRESS";
                col.Name             = col.DataPropertyName;
                col.ReadOnly         = true;
                dgvRelation.Columns.Add(col);
            }
            col                            = new DataGridViewTextBoxColumnEx();
            col.HeaderText                 = "补偿比例(%)";
            col.Width                      = 100;
            col.DataPropertyName           = "COMP_RATE";
            col.ReadOnly                   = false;
            col.MaxInputLength             = 6;
            col.Name                       = col.DataPropertyName;
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            col.DefaultCellStyle.Format    = "##0.#0";
            col.DefaultCellStyle.BackColor = Color.LightCyan;
            ((DataGridViewTextBoxColumnEx)col).TextFormatStyle = TextFormatStyle.UNumberic;
            dgvRelation.Columns.Add(col);

            DataGridViewButtonColumn btnCol = new DataGridViewButtonColumn();

            btnCol.HeaderText       = "删除";
            btnCol.Width            = 60;
            btnCol.DataPropertyName = "DELETED";
            btnCol.Name             = btnCol.DataPropertyName;
            dgvRelation.Columns.Add(btnCol);
        }
Example #5
0
        private void SetGrids(string strHour)
        {
            lblFocus.Focus();
            gvWholeTimeline.Columns.Clear();
            gvHours.Columns.Clear();
            gvTimeLine.Columns.Clear();
            gvWorkOrder.Columns.Clear();
            gvTrueCycle.Columns.Clear();



            int intHourSP = Convert.ToInt32(strHour);



            //string strSQL = "p_tblLeakTestFPYThreeHour " + intHourSP.ToString();
            string  strSQL    = strLineSpecificStoredProc; // + intHourSP.ToString() + ", " + TSID.ToString();
            DataSet ds        = clsDAL.ProcessSQL(strSQL, "Visual");
            var     leakTests = new TupleList4 <int, int, int, int, string, int, int>();

            colorGrid.Clear();
            breakTimes.Clear();
            trueCycleTimes.Clear();

            returnData newList = new returnData();

            if (clsDAL.dsHasData(ds))
            {
                foreach (DataTable table in ds.Tables)
                {
                    foreach (DataRow dr in table.Rows)
                    {
                        int    intHour     = Convert.ToInt32(dr["hour"].ToString());
                        int    intMinute   = Convert.ToInt32(dr["minit"].ToString());
                        int    intPassFail = Convert.ToInt32(dr["cntPass"].ToString());
                        int    intGridCol  = Convert.ToInt32(dr["GridCol"].ToString());
                        string strWO       = dr["WorkOrder"].ToString();
                        int    intColSpan  = Convert.ToInt32(dr["WOGridSpan"].ToString());
                        int    intBegWOCol = Convert.ToInt32(dr["WOGridStart"].ToString());
                        string strBegin    = dr["Break1"].ToString();
                        leakTests.Add(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol);
                        colorGrid.Add(new Tuple <int, int, int, int, string, int, int, Tuple <string> >(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol, new Tuple <string>(strBegin)));

                        int intBreak1    = Convert.ToInt32(dr["Break1"].ToString());
                        int intLunch     = Convert.ToInt32(dr["Lunch"].ToString());
                        int intBreak2    = Convert.ToInt32(dr["Break2"].ToString());
                        int intCycleTime = Convert.ToInt32(dr["TCycle"].ToString());

                        breakTimes.Add(new Tuple <int, int, int, int, int>(intHour, intMinute, intBreak1, intLunch, intBreak2));
                        trueCycleTimes.Add(new Tuple <int, int, int>(intHour, intMinute, intCycleTime));
                    }
                }

                //lstMaster.Add(newList);
            }

            DataGridViewTextBoxColumnEx col3 = new DataGridViewTextBoxColumnEx();

            for (int z = 0; z < 180; z++)
            {
                DataGridViewTextBoxColumnEx col  = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col5 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col6 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col7 = new DataGridViewTextBoxColumnEx();

                gvWholeTimeline.RowHeadersVisible          = false;
                gvWholeTimeline.ColumnHeadersVisible       = false;
                gvWholeTimeline.ScrollBars                 = ScrollBars.None;
                gvWholeTimeline.CellBorderStyle            = DataGridViewCellBorderStyle.None;
                gvWholeTimeline.BorderStyle                = BorderStyle.None;
                gvWholeTimeline.DefaultCellStyle.BackColor = Color.White;


                gvWorkOrder.RowHeadersVisible    = false;
                gvWorkOrder.ColumnHeadersVisible = false;
                gvWorkOrder.ScrollBars           = ScrollBars.None;
                gvWorkOrder.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvWorkOrder.BorderStyle          = BorderStyle.None;

                gvTimeLine.RowHeadersVisible    = false;
                gvTimeLine.ColumnHeadersVisible = false;
                gvTimeLine.ScrollBars           = ScrollBars.None;
                gvTimeLine.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTimeLine.BorderStyle          = BorderStyle.None;

                gvTrueCycle.RowHeadersVisible    = false;
                gvTrueCycle.ColumnHeadersVisible = false;
                gvTrueCycle.ScrollBars           = ScrollBars.None;
                gvTrueCycle.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTrueCycle.BorderStyle          = BorderStyle.None;


                col.FillWeight = 10;
                col.Width      = 10;
                col.Name       = z.ToString();

                col5.FillWeight = 10;
                col5.Width      = 10;
                col5.Name       = z.ToString();

                col6.FillWeight = 10;
                col6.Width      = 10;
                col6.Name       = z.ToString();

                col7.FillWeight = 10;
                col7.Width      = 10;
                col7.Name       = z.ToString();

                gvWholeTimeline.Columns.Add(col);
                gvWorkOrder.Columns.Add(col5);
                gvTimeLine.Columns.Add(col6);
                gvTrueCycle.Columns.Add(col7);

                //gvWholeTimeline.Rows[0].Cells[z].Value = z.ToString();
                gvWholeTimeline.Height = gvWholeTimeline.Rows[0].Height;
                gvWorkOrder.Height     = gvWorkOrder.Rows[0].Height;
                gvTimeLine.Height      = gvTimeLine.Rows[0].Height;
                gvTrueCycle.Height     = gvTimeLine.Rows[0].Height;

                lblFocus.Focus();


                if (z % 15 == 0)
                {
                    gvWholeTimeline.Rows[0].Cells[z].Value      = '\u25CF';
                    gvWholeTimeline.Rows[0].Cells[z].Style.Font = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);

                    int[] hours = { 0, 60, 120, 180 };
                    if (hours.Contains(z))
                    {
                        gvWholeTimeline.Rows[0].Cells[z].Value = null;
                    }
                }
            }


            int setHour = 0;

            strHour = (Convert.ToInt32(strHour) - 2).ToString();

            for (int z = 0; z <= 2; z++)
            {
                DataGridViewTextBoxColumnEx col2 = new DataGridViewTextBoxColumnEx();
                //col2.FillWeight = 10;
                col2.Width = 600;
                col2.Name  = z.ToString();

                gvHours.RowHeadersVisible    = false;
                gvHours.ColumnHeadersVisible = false;
                gvHours.ScrollBars           = ScrollBars.None;
                gvHours.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvHours.BorderStyle          = BorderStyle.None;
                gvHours.Columns.Add(col2);
                gvHours.Height = gvHours.Rows[0].Height;



                gvHours.Rows[0].Cells[z].Style.Font = new Font("Arial", 24F, FontStyle.Bold, GraphicsUnit.Pixel);

                SetBreaksFromTable(Convert.ToInt32(strHour));

                if (z == 0)
                {
                    //gvHours.Rows[0].Cells[z].Value = strHour;
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(strHour));
                    setHour = Convert.ToInt32(strHour);

                    if (setHour == lu)
                    {
                        SetSpan(gvTimeLine, z, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    if (setHour == intB1)
                    {
                        SetSpan(gvTimeLine, z, intB1TotalMins, 10, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    if (setHour == intB2)
                    {
                        SetSpan(gvTimeLine, z, 0, intB2TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }
                }

                if (z == 1)
                {
                    setHour = setHour + 1;
                    //gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(setHour));

                    if (setHour == 11)
                    {
                        SetSpan(gvTimeLine, 60, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[60].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[60].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[60].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[60].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 9)
                    {
                        SetSpan(gvTimeLine, 60, 0, intB1TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[60].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[60].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[60].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[60].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 13)
                    {
                        SetSpan(gvTimeLine, 60, 0, intB2TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[60].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[60].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[60].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[60].Style.ForeColor = Color.Black;
                    }
                }

                if (z == 2)
                {
                    setHour = setHour + 1;
                    //gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(setHour));

                    if (setHour == 11)
                    {
                        SetSpan(gvTimeLine, 120, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[120].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[120].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[120].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[120].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 9)
                    {
                        SetSpan(gvTimeLine, 120, 0, intB1TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[120].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[120].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[120].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[120].Style.ForeColor = Color.Black;
                    }

                    if (setHour == 13)
                    {
                        SetSpan(gvTimeLine, 120, 0, intB2TotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[120].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[120].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[120].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[120].Style.ForeColor = Color.Black;
                    }
                }


                if (z == 3)
                {
                    if (setHour == 11)
                    {
                        SetSpan(gvTimeLine, z, 0, intluTotalMins, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 16F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    setHour = setHour + 1;
                    gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                }

                SetSpan(gvHours, z, 0, 60, 0, "Middle");
            }


            SetThreeHour(Convert.ToInt32(strHour));

            //int intShiftGrid = ((Convert.ToInt32(strHour) * 60) + 60) / 180;
            //gvWholeTimeline.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvWorkOrder.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvTimeLine.FirstDisplayedScrollingColumnIndex = intShiftGrid;
        }
Example #6
0
        /// <summary>
        /// 方法说明:初始化单元格
        /// 作    者:jason.tang
        /// 完成时间:2012-12-17
        /// </summary>
        /// <param name="listRows">行数</param>
        /// <param name="listColumns">列数</param>
        /// <param name="isInit">是否新建的初始化</param>
        private void InitDataGridView(List <int> listRows, List <int> listColumns, DataGridView datagridview)
        {
            int index = 0;

            //增加列
            DataGridViewTextBoxColumnEx column = new DataGridViewTextBoxColumnEx();

            listColWidth  = new List <int>();
            listRowHeight = new List <int>();

            foreach (int i in listColumns)
            {
                column       = new DataGridViewTextBoxColumnEx();
                column.Width = i;
                if (index == listColumns.Count - 1)
                {
                    column.Width = i - 3;
                }
                datagridview.Columns.Insert(index, column);
                listColWidth.Add(column.Width);
                index++;
            }

            index = 0;
            //增加行
            foreach (int i in listRows)
            {
                datagridview.Rows.Insert(index, 1);
                index++;
            }

            //行高设定
            index = 0;
            foreach (DataGridViewRow row in datagridview.Rows)
            {
                if (index < listRows.Count)
                {
                    row.Height = listRows[index];
                }
                if (index == datagridview.Rows.Count - 1)
                {
                    row.Height = row.Height - 3;
                }
                listRowHeight.Add(row.Height);
                index++;
            }


            float pageSize    = (float)_breadth;
            float size        = _breadth < 4 ? 8f - _breadth * 1.5f : 4f - _breadth;
            Font  defaultFont = this.Font;

            foreach (DataGridViewRow row in datagridview.Rows)
            {
                foreach (DataGridViewColumn col in datagridview.Columns)
                {
                    row.Cells[col.Index].Style.Font     = new Font(defaultFont.FontFamily, defaultFont.Size - size, defaultFont.Style);
                    row.Cells[col.Index].Style.WrapMode = DataGridViewTriState.True;

                    List <DataGridViewCustomerCellStyle> listCellStyle = new List <DataGridViewCustomerCellStyle>();
                    DataGridViewCustomerCellStyle        cellStyle     = new DataGridViewCustomerCellStyle();
                    cellStyle.Font     = defaultFont;
                    cellStyle.WrapMode = DataGridViewTriState.True;
                    listCellStyle.Add(cellStyle);
                    ((DataGridViewTextBoxCellEx)row.Cells[col.Index]).CustStyle = listCellStyle;
                    ((DataGridViewTextBoxCellEx)row.Cells[col.Index]).SpanCell  = new Point(-1, -1);
                }
            }
        }
Example #7
0
        private void SetGrids(string strHour)
        {
            lblFocus.Focus();
            gvWholeTimeline.Columns.Clear();
            gvHours.Columns.Clear();
            gvTimeLine.Columns.Clear();
            gvWorkOrder.Columns.Clear();
            gvTrueCycle.Columns.Clear();


            //string strSQL = "p_tblLeakTestFPY";
            string  strSQL    = strLineSpecificStoredProc;
            DataSet ds        = clsDAL.ProcessSQL(strSQL, "Visual");
            var     leakTests = new TupleList4 <int, int, int, int, string, int, int>();
            var     breakList = new TupleListBreaks <int, int, int, string, int>();
            var     spanWO    = new TupleWO <int, int, string>();

            if (clsDAL.dsHasData(ds))
            {
                DataTable dt1 = ds.Tables[0];
                DataTable dt2 = ds.Tables[1];

                foreach (DataRow dr in dt1.Rows)
                {
                    int    intHour      = Convert.ToInt32(dr["hour"].ToString());
                    int    intMinute    = Convert.ToInt32(dr["minit"].ToString());
                    int    intPassFail  = Convert.ToInt32(dr["cntPass"].ToString());
                    int    intGridCol   = Convert.ToInt32(dr["GridCol"].ToString());
                    string strWO        = dr["WorkOrder"].ToString();
                    int    intColSpan   = Convert.ToInt32(dr["WOGridSpan"].ToString());
                    int    intBegWOCol  = Convert.ToInt32(dr["WOGridStart"].ToString());
                    int    intCycleTime = Convert.ToInt32(dr["TCycle"].ToString());
                    leakTests.Add(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol);

                    if (intPassFail == 1)
                    {
                        trueCycleTimes.Add(new Tuple <int, int, int, int>(intHour, intMinute, intCycleTime, intGridCol));
                    }
                }

                foreach (DataRow dr in dt2.Rows)
                {
                    int    intHour      = Convert.ToInt32(dr["hour"].ToString());
                    int    intMinute    = Convert.ToInt32(dr["minit"].ToString());
                    int    intDuration  = Convert.ToInt32(dr["Duration"].ToString());
                    string strBreakType = dr["BreakType"].ToString();
                    int    intBreakCol  = Convert.ToInt32(dr["BreakCol"].ToString());
                    breakList.Add(intHour, intMinute, intDuration, strBreakType, intBreakCol);
                }

                //foreach (DataTable table in ds.Tables)
                //{
                //    foreach (DataRow dr in table.Rows)
                //    {
                //        int intHour = Convert.ToInt32(dr["hour"].ToString());
                //        int intMinute = Convert.ToInt32(dr["minit"].ToString());
                //        int intPassFail = Convert.ToInt32(dr["cntPass"].ToString());
                //        int intGridCol = Convert.ToInt32(dr["GridCol"].ToString());
                //        string strWO = dr["WorkOrder"].ToString();
                //        int intColSpan = Convert.ToInt32(dr["WOGridSpan"].ToString());
                //        int intBegWOCol = Convert.ToInt32(dr["WOGridStart"].ToString());
                //        leakTests.Add(intHour, intMinute, intPassFail, intGridCol, strWO, intColSpan, intBegWOCol);
                //    }
                //}
            }

            DataGridViewTextBoxColumnEx col3 = new DataGridViewTextBoxColumnEx();

            for (int z = 0; z < 1440; z++)
            {
                DataGridViewTextBoxColumnEx col  = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col5 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col6 = new DataGridViewTextBoxColumnEx();
                DataGridViewTextBoxColumnEx col7 = new DataGridViewTextBoxColumnEx();


                gvWholeTimeline.RowHeadersVisible    = false;
                gvWholeTimeline.ColumnHeadersVisible = false;
                //gvWholeTimeline.ScrollBars = ScrollBars.None;
                gvWholeTimeline.CellBorderStyle = DataGridViewCellBorderStyle.None;
                gvWholeTimeline.BorderStyle     = BorderStyle.None;

                gvWorkOrder.RowHeadersVisible    = false;
                gvWorkOrder.ColumnHeadersVisible = false;
                gvWorkOrder.ScrollBars           = ScrollBars.None;
                gvWorkOrder.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvWorkOrder.BorderStyle          = BorderStyle.None;

                gvTimeLine.RowHeadersVisible    = false;
                gvTimeLine.ColumnHeadersVisible = false;
                gvTimeLine.ScrollBars           = ScrollBars.None;
                gvTimeLine.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTimeLine.BorderStyle          = BorderStyle.None;

                gvTrueCycle.RowHeadersVisible    = false;
                gvTrueCycle.ColumnHeadersVisible = false;
                gvTrueCycle.ScrollBars           = ScrollBars.None;
                gvTrueCycle.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvTrueCycle.BorderStyle          = BorderStyle.None;

                col.FillWeight = 10;
                col.Width      = 4;
                col.Name       = z.ToString();

                col5.FillWeight = 10;
                col5.Width      = 4;
                col5.Name       = z.ToString();

                col6.FillWeight = 10;
                col6.Width      = 4;
                col6.Name       = z.ToString();

                col7.FillWeight = 10;
                col7.Width      = 10;
                col7.Name       = z.ToString();

                gvWholeTimeline.Columns.Add(col);
                gvWorkOrder.Columns.Add(col5);
                gvTimeLine.Columns.Add(col6);
                gvTrueCycle.Columns.Add(col7);


                gvWholeTimeline.Height = gvWholeTimeline.Rows[0].Height + 20;
                gvWorkOrder.Height     = gvWorkOrder.Rows[0].Height;
                gvTimeLine.Height      = gvTimeLine.Rows[0].Height;
                gvTrueCycle.Height     = gvTimeLine.Rows[0].Height + 10;

                lblFocus.Focus();
            }


            int setHour = 0;

            for (int z = 0; z <= 60; z++)
            {
                DataGridViewTextBoxColumnEx col2 = new DataGridViewTextBoxColumnEx();
                //col2.FillWeight = 10;
                col2.Width = 300;
                col2.Name  = z.ToString();

                gvHours.RowHeadersVisible    = false;
                gvHours.ColumnHeadersVisible = false;
                gvHours.ScrollBars           = ScrollBars.None;
                gvHours.CellBorderStyle      = DataGridViewCellBorderStyle.None;
                gvHours.BorderStyle          = BorderStyle.None;
                gvHours.Columns.Add(col2);
                gvHours.Height = gvHours.Rows[0].Height;



                //strHour = dtNow.ToString("%h");

                gvHours.Rows[0].Cells[z].Style.Font = new Font("Arial", 24F, FontStyle.Bold, GraphicsUnit.Pixel);


                if (z == 0)
                {
                    //gvHours.Rows[0].Cells[z].Value = strHour;
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(Convert.ToInt32(strHour));
                    setHour = Convert.ToInt32(strHour);
                }
                else
                {
                    setHour = setHour + 1;
                    //gvHours.Rows[0].Cells[z].Value = setHour.ToString();
                    gvHours.Rows[0].Cells[z].Value = TwelveHour(setHour);
                }
            }


            for (int z = 0; z < 1440; z++)
            {
                foreach (var x in leakTests)
                {
                    int [] ticks = { 720, 735, 750, 765, 780, 795, 810, 825, 840, 855, 870, 885 };

                    foreach (var ct in trueCycleTimes)
                    {
                        if (ct.Item4 == z)
                        {
                            SetSpan(gvTrueCycle, ct.Item4, 0, ct.Item3, 0, "Middle");
                            gvTrueCycle.Rows[0].Cells[ct.Item4].Value      = ct.Item3.ToString() + " min";
                            gvTrueCycle.Rows[0].Cells[ct.Item4].Style.Font = new Font("Arial", 10F, FontStyle.Bold, GraphicsUnit.Pixel);
                        }
                    }


                    if (z % 15 == 0)
                    {
                        gvWholeTimeline.Rows[0].Cells[z].Value      = "*";
                        gvWholeTimeline.Rows[0].Cells[z].Style.Font = new Font("Arial", 8F, FontStyle.Bold, GraphicsUnit.Pixel);

                        int[] hours = { 0, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 960, 1020, 1080, 1140, 1200, 1260, 1320, 1380, 1440 };

                        if (hours.Contains(z))
                        {
                            gvWholeTimeline.Rows[0].Cells[z].Value = null;
                        }
                    }


                    if (x.Item4 == z)
                    {
                        if (x.Item3 == 0)
                        {
                            gvWholeTimeline.Rows[0].Cells[x.Item4].Style.BackColor = Color.Firebrick;
                        }
                        if (x.Item3 == 1)
                        {
                            gvWholeTimeline.Rows[0].Cells[x.Item4].Style.BackColor = Color.MediumSeaGreen;
                        }
                    }


                    if (x.Item7 == z)
                    {
                        gvWorkOrder.Rows[0].Cells[x.Item7].Style.BackColor = Color.WhiteSmoke;

                        if (x.Item6 == 0)
                        {
                            gvWorkOrder.Rows[0].Cells[20].Style.BackColor = Color.WhiteSmoke;
                            SetSpan(gvWorkOrder, x.Item7, 0, 20, 0, "Middle");
                            gvWorkOrder.Rows[0].Cells[x.Item7].Value = x.Item5.ToString();
                            gvWorkOrder.Rows[0].Cells[z].Style.Font  = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        }
                        else
                        {
                            for (int colSpan = 1; colSpan <= x.Item6; colSpan++)
                            {
                                gvWorkOrder.Rows[0].Cells[x.Item7 + colSpan].Style.BackColor = Color.WhiteSmoke;
                            }

                            SetSpan(gvWorkOrder, x.Item7, 0, x.Item6, 0, "Middle");
                            gvWorkOrder.Rows[0].Cells[x.Item7].Value = x.Item5.ToString();
                            gvWorkOrder.Rows[0].Cells[z].Style.Font  = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        }
                    }
                }


                var date             = DateTime.Now;
                var colorCurrentTime = ((date.Hour * 60)) + date.Minute;
                if (z == colorCurrentTime)
                {
                    gvWholeTimeline.Rows[0].Cells[z].Style.BackColor     = Color.Khaki;
                    gvWholeTimeline.Rows[0].Cells[z + 1].Style.BackColor = Color.Khaki;
                    gvWholeTimeline.Rows[0].Cells[z - 1].Style.BackColor = Color.FromKnownColor(KnownColor.Window);

                    gvWorkOrder.Rows[0].Cells[z].Style.BackColor     = Color.Khaki;
                    gvWorkOrder.Rows[0].Cells[z + 1].Style.BackColor = Color.Khaki;
                    gvWorkOrder.Rows[0].Cells[z - 1].Style.BackColor = Color.FromKnownColor(KnownColor.Window);

                    gvTimeLine.Rows[0].Cells[z].Style.BackColor     = Color.Khaki;
                    gvTimeLine.Rows[0].Cells[z + 1].Style.BackColor = Color.Khaki;
                    gvTimeLine.Rows[0].Cells[z - 1].Style.BackColor = Color.FromKnownColor(KnownColor.Window);
                }
                ////test color 60 minutes
                //if (z >= 900 && z <= 959)
                //{
                //    gvWholeTimeline.Rows[0].Cells[z].Style.BackColor = Color.Khaki;
                //    gvWholeTimeline.Rows[0].Cells[z].Value = "$";
                //}
                //if (z >= 960 && z <= 1019)
                //{
                //    gvWholeTimeline.Rows[0].Cells[z].Style.BackColor = Color.LightCoral;
                //    gvWholeTimeline.Rows[0].Cells[z].Value = "$";
                //}


                foreach (var col in breakList)
                {
                    if (col.Item5 == z && col.Item4.Contains("Break"))
                    {
                        SetSpan(gvTimeLine, z, 0, col.Item3, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Break";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }

                    if (col.Item5 == z && col.Item4.Contains("Lunch"))
                    {
                        SetSpan(gvTimeLine, z, 0, col.Item3, 0, "Middle");
                        gvTimeLine.Rows[0].Cells[z].Value           = "Lunch";
                        gvTimeLine.Rows[0].Cells[z].Style.Font      = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                        gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                        gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                    }
                }

                //if (z == 600 || z ==840)
                //{
                //    SetSpan(gvTimeLine, z, 0, 10, 0, "Middle");
                //    gvTimeLine.Rows[0].Cells[z].Value = "Break";
                //    gvTimeLine.Rows[0].Cells[z].Style.Font = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                //    gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                //    gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;

                //}

                //if (z == 720)
                //{
                //    SetSpan(gvTimeLine, z, 0, 20, 0, "Middle");
                //    gvTimeLine.Rows[0].Cells[z].Value = "Lunch";
                //    gvTimeLine.Rows[0].Cells[z].Style.Font = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Pixel);
                //    gvTimeLine.Rows[0].Cells[z].Style.BackColor = Color.LightSteelBlue;
                //    gvTimeLine.Rows[0].Cells[z].Style.ForeColor = Color.Black;
                //}
            }

            //int intShiftGrid = (Convert.ToInt32(strHour) * 60) + 60;
            //gvWholeTimeline.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvWorkOrder.FirstDisplayedScrollingColumnIndex = intShiftGrid;
            //gvTimeLine.FirstDisplayedScrollingColumnIndex = intShiftGrid;
        }