void loadSchedule(int scheduleID) { dgvTimezone.Rows.Clear(); dgvSchedule.Rows.Clear(); //school name int school_id = VariableGlobal.school_id; var school = (from p in db.CpSchools where p.Id == school_id select p).SingleOrDefault(); this.lblSchoolName.Text = school.Code.Trim() + ". " + school.Name; // Classes Name, Teachers Name String[] ClassNames = new String[100]; String[] TeacherNames = new String[200]; var cpclass = from p in db.CpClasses where p.SchoolId == school_id select p; foreach (var cl in cpclass) { ClassNames[cl.Id] = cl.Name; } var cpstaff = from p in db.CpStaffs where p.SchoolId == school_id select p; foreach (var staff in cpstaff) { TeacherNames[staff.Id] = staff.Name; } //doc record schedule, lay fromDate, toDate var scheduleRc = (from p in db.CpSchedules where p.Id == scheduleID select p).SingleOrDefault(); DateTime fromDate = (DateTime)scheduleRc.StartDate, toDate = (DateTime)scheduleRc.EndDate; //update label time String rangeTimeStr = "平成" + (fromDate.Year - 1988) + "年" + fromDate.Month + "月" + fromDate.Day + "日" + "(" + jaWeekday["" + fromDate.DayOfWeek] + ")"; rangeTimeStr += " ~ " + toDate.Month + "月" + toDate.Day + "日" + "(" + jaWeekday["" + toDate.DayOfWeek] + ")"; lbTimeRange.Text = rangeTimeStr; //add them cac cot ngay vao dgvSchedule DateTime date = fromDate; while (date <= toDate) { //datagridview DataGridViewLabelXColumn cl = new DataGridViewLabelXColumn(); cl.HeaderText = date.Day + "\n" + "(" + jaWeekday["" + date.DayOfWeek] + ")"; cl.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; cl.HeaderCell.Style.Font = new Font("Meiryo", 7.5F, FontStyle.Bold); cl.Width = 35; String wday = date.DayOfWeek.ToString(); if (wday == "Saturday") { cl.HeaderCell.Style.ForeColor = Color.Blue; cl.HeaderCell.Style.BackColor = Color.Blue; } else if (wday == "Sunday") { cl.HeaderCell.Style.ForeColor = Color.Red; cl.HeaderCell.Style.BackColor = Color.Red; cl.DefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#D4C1D0"); } dgvSchedule.Columns.Add(cl); date = date.AddDays(1); } //doc tat ca cac scheduleDetail bang scheduleID var scheduleDetails = from p in db.CpScheduleDetails where p.ScheduleID == scheduleID orderby p.Id select p; //khoi tao classid trc, date trc int preClassID = -1, preDate = -1; //khoi tao mang schedule schedule = new int[scheduleDetails.Count()]; scheduleLen = 0; //khoi tao timezoneIDs, chua biet co bao nhieu ca lam viec timezoneIDs = new int[20]; tzShorts = new String[20]; tzColors = new String[20]; tzCnt = 0; // index dong dau tien cua lop hien tai, update khi sang lop moi int startRow = 0; // so dem giao vien, reset khi chuyen sang ngay moi int staffCnt = -1; foreach (var schD in scheduleDetails) { //duyet tao data cho cac bang schedule, classIDs, classTeacher, timezoneIDs //tim index cua timezone, neu ko ton tai gan them int i = -1; if (schD.TimezoneID >= 0) { for (i = 0; i < tzCnt; i++) { if (timezoneIDs[i] == schD.TimezoneID) break; } if (i == tzCnt) { timezoneIDs[i] = (int)schD.TimezoneID; var tz = (from p in db.CpTimeZones where p.Id == schD.TimezoneID select p).SingleOrDefault(); tzShorts[i] = tz.Abbreviation; tzColors[i] = tz.Color; //add vao grid timezone int ind = dgvTimezone.Rows.Add("", tz.Abbreviation, ((DateTime)tz.StartTime).ToString("t") + "~" + ((DateTime)tz.EndTime).ToString("t")); dgvTimezone.Rows[ind].Cells[0].Style.BackColor = System.Drawing.ColorTranslator.FromHtml(tz.Color); tzCnt++; } } //neu chuyen lop moi, viet ten lop o dau, update startRow String classStr = "" ; if (schD.ClassID != preClassID) { classStr = "" + ClassNames[schD.ClassID]; startRow += staffCnt + 1; } //neu chuyen ngay moi, reset staffCnt, neu ko, tang them 1 staffCnt = schD.Date == preDate ? staffCnt + 1 : 0; //if (schD.ClassID == 4) break;//debug //neu la ngay 0 add them row if (schD.Date == 0) { dgvSchedule.Rows.Add(classStr, TeacherNames[schD.StaffID]); } // neu ko, gan vao dgvSchedule else { //dgvSchedule[schD.Date + 2, startRow + staffCnt].Value = schD.TimezoneID; } //gan ten, mau if (i >= 0) { dgvSchedule[schD.Date + 2, startRow + staffCnt].Value = tzShorts[i]; ((DataGridViewLabelXCell)dgvSchedule[schD.Date + 2, startRow + staffCnt]).Style.BackColor = System.Drawing.ColorTranslator.FromHtml(tzColors[i]); } //update schedule, scheduleLen, preDate, preClassID schedule[scheduleLen] = i; scheduleLen++; preDate = schD.Date; preClassID = schD.ClassID; } //tu timezoneIDs tinh ra tzShortname, tzColors }
private bool GetWordWrap(DataGridViewLabelXColumn oc, DataGridViewCellStyle cellStyle) { if (oc.WordWrap == true) return (true); switch (cellStyle.WrapMode) { case DataGridViewTriState.True: return (true); case DataGridViewTriState.False: return (false); } return (DataGridView.DefaultCellStyle.WrapMode == DataGridViewTriState.True); }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.panelEx1 = new PanelEx(); this.dataGridViewX1 = new DataGridViewX(); this.colDoctor = new DataGridViewLabelXColumn(); this.colAnteMeridiem1 = new DataGridViewButtonXColumn(); this.colPostMeridiem1 = new DataGridViewButtonXColumn(); this.colAnteMeridiem2 = new DataGridViewButtonXColumn(); this.colPostMeridiem2 = new DataGridViewButtonXColumn(); this.colAnteMeridiem3 = new DataGridViewButtonXColumn(); this.colPostMeridiem3 = new DataGridViewButtonXColumn(); this.colAnteMeridiem4 = new DataGridViewButtonXColumn(); this.colPostMeridiem4 = new DataGridViewButtonXColumn(); this.colAnteMeridiem5 = new DataGridViewButtonXColumn(); this.colPostMeridiem5 = new DataGridViewButtonXColumn(); this.colAnteMeridiem6 = new DataGridViewButtonXColumn(); this.colPostMeridiem6 = new DataGridViewButtonXColumn(); this.colAnteMeridiem7 = new DataGridViewButtonXColumn(); this.colPostMeridiem7 = new DataGridViewButtonXColumn(); this.colAnteMeridiem8 = new DataGridViewButtonXColumn(); this.colPostMeridiem8 = new DataGridViewButtonXColumn(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.lbDate8 = new LabelX(); this.lbDate7 = new LabelX(); this.lbDate6 = new LabelX(); this.lbDate5 = new LabelX(); this.lbDate3 = new LabelX(); this.lbDate1 = new LabelX(); this.labelX5 = new LabelX(); this.lbDate2 = new LabelX(); this.lbDate4 = new LabelX(); this.panelInfo = new PanelEx(); this.plPriority = new PanelEx(); this.itemPrioritys = new ItemPanel(); this.labelX4 = new LabelX(); this.panelEx2 = new PanelEx(); this.btnSwitch = new SwitchButton(); this.chkWaitforTime = new CheckBoxX(); this.cmbDepartment = new ComboBoxEx(); this.labelX3 = new LabelX(); this.cmbHospital = new ComboBoxEx(); this.labelX2 = new LabelX(); this.cmbArea = new ComboBoxEx(); this.labelX1 = new LabelX(); this.btnRefresh = new ButtonX(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.panelEx1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)this.dataGridViewX1).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.plPriority.SuspendLayout(); this.panelEx2.SuspendLayout(); base.SuspendLayout(); this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control; this.panelEx1.ColorSchemeStyle = eDotNetBarStyle.StyleManagerControlled; this.panelEx1.Controls.Add(this.dataGridViewX1); this.panelEx1.Controls.Add(this.tableLayoutPanel1); this.panelEx1.Controls.Add(this.panelInfo); this.panelEx1.Controls.Add(this.plPriority); this.panelEx1.Controls.Add(this.panelEx2); this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty; this.panelEx1.Dock = System.Windows.Forms.DockStyle.Fill; this.panelEx1.Location = new System.Drawing.Point(0, 0); this.panelEx1.Name = "panelEx1"; this.panelEx1.Size = new System.Drawing.Size(1082, 504); this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; this.panelEx1.Style.BackColor1.ColorSchemePart = eColorSchemePart.PanelBackground; this.panelEx1.Style.Border = eBorderType.SingleLine; this.panelEx1.Style.BorderColor.ColorSchemePart = eColorSchemePart.PanelBorder; this.panelEx1.Style.ForeColor.ColorSchemePart = eColorSchemePart.PanelText; this.panelEx1.Style.GradientAngle = 90; this.panelEx1.TabIndex = 1; this.dataGridViewX1.AllowDrop = true; this.dataGridViewX1.AllowUserToAddRows = false; this.dataGridViewX1.AllowUserToDeleteRows = false; this.dataGridViewX1.AllowUserToResizeColumns = false; this.dataGridViewX1.BackgroundColor = System.Drawing.Color.FromArgb(254, 254, 254); dataGridViewCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle.Font = new System.Drawing.Font("SimSun", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); dataGridViewCellStyle.ForeColor = System.Drawing.Color.Black; dataGridViewCellStyle.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle.SelectionForeColor = System.Drawing.Color.Black; dataGridViewCellStyle.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridViewX1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle; this.dataGridViewX1.ColumnHeadersHeight = 30; this.dataGridViewX1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; this.dataGridViewX1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colDoctor, this.colAnteMeridiem1, this.colPostMeridiem1, this.colAnteMeridiem2, this.colPostMeridiem2, this.colAnteMeridiem3, this.colPostMeridiem3, this.colAnteMeridiem4, this.colPostMeridiem4, this.colAnteMeridiem5, this.colPostMeridiem5, this.colAnteMeridiem6, this.colPostMeridiem6, this.colAnteMeridiem7, this.colPostMeridiem7, this.colAnteMeridiem8, this.colPostMeridiem8 }); dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(254, 254, 254); dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft YaHei", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); dataGridViewCellStyle2.ForeColor = System.Drawing.Color.Black; dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridViewX1.DefaultCellStyle = dataGridViewCellStyle2; this.dataGridViewX1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridViewX1.EnableHeadersVisualStyles = false; this.dataGridViewX1.GridColor = System.Drawing.Color.FromArgb(200, 200, 200); this.dataGridViewX1.Location = new System.Drawing.Point(0, 158); this.dataGridViewX1.MultiSelect = false; this.dataGridViewX1.Name = "dataGridViewX1"; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle3.Font = new System.Drawing.Font("SimSun", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); dataGridViewCellStyle3.ForeColor = System.Drawing.Color.Black; dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridViewX1.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; this.dataGridViewX1.RowHeadersVisible = false; this.dataGridViewX1.RowHeadersWidth = 30; dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewX1.RowsDefaultCellStyle = dataGridViewCellStyle4; this.dataGridViewX1.RowTemplate.Height = 50; this.dataGridViewX1.Size = new System.Drawing.Size(1082, 346); this.dataGridViewX1.TabIndex = 2; this.dataGridViewX1.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewX1_CellContentDoubleClick); this.dataGridViewX1.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridViewX1_CellMouseDown); this.colDoctor.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colDoctor.DataPropertyName = "Doctor"; this.colDoctor.FillWeight = 94.38452f; this.colDoctor.HeaderText = "医生"; this.colDoctor.MinimumWidth = 100; this.colDoctor.Name = "colDoctor"; this.colDoctor.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.colDoctor.Text = ""; this.colDoctor.TextAlignment = System.Drawing.StringAlignment.Center; this.colDoctor.WordWrap = true; this.colAnteMeridiem1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem1.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem1.DataPropertyName = "AnteMeridiem1"; this.colAnteMeridiem1.FillWeight = 94.38452f; this.colAnteMeridiem1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.colAnteMeridiem1.HeaderText = "上午"; this.colAnteMeridiem1.Name = "colAnteMeridiem1"; this.colAnteMeridiem1.ReadOnly = true; this.colAnteMeridiem1.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem1.Text = null; this.colPostMeridiem1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem1.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem1.DataPropertyName = "PostMeridiem1"; this.colPostMeridiem1.FillWeight = 94.38452f; this.colPostMeridiem1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.colPostMeridiem1.HeaderText = "下午"; this.colPostMeridiem1.Name = "colPostMeridiem1"; this.colPostMeridiem1.ReadOnly = true; this.colPostMeridiem1.SplitButton = true; this.colPostMeridiem1.Style = eDotNetBarStyle.StyleManagerControlled; this.colPostMeridiem1.Text = null; this.colAnteMeridiem2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem2.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem2.DataPropertyName = "AnteMeridiem2"; this.colAnteMeridiem2.FillWeight = 94.38452f; this.colAnteMeridiem2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.colAnteMeridiem2.HeaderText = "上午"; this.colAnteMeridiem2.Name = "colAnteMeridiem2"; this.colAnteMeridiem2.ReadOnly = true; this.colAnteMeridiem2.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem2.Text = null; this.colPostMeridiem2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem2.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem2.DataPropertyName = "PostMeridiem2"; this.colPostMeridiem2.FillWeight = 94.38452f; this.colPostMeridiem2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.colPostMeridiem2.HeaderText = "下午"; this.colPostMeridiem2.Name = "colPostMeridiem2"; this.colPostMeridiem2.ReadOnly = true; this.colPostMeridiem2.Text = null; this.colAnteMeridiem3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem3.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem3.DataPropertyName = "AnteMeridiem3"; this.colAnteMeridiem3.FillWeight = 94.38452f; this.colAnteMeridiem3.HeaderText = "上午"; this.colAnteMeridiem3.Name = "colAnteMeridiem3"; this.colAnteMeridiem3.ReadOnly = true; this.colAnteMeridiem3.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem3.Text = null; this.colPostMeridiem3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem3.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem3.DataPropertyName = "PostMeridiem3"; this.colPostMeridiem3.FillWeight = 94.38452f; this.colPostMeridiem3.HeaderText = "下午"; this.colPostMeridiem3.Name = "colPostMeridiem3"; this.colPostMeridiem3.ReadOnly = true; this.colPostMeridiem3.Style = eDotNetBarStyle.StyleManagerControlled; this.colPostMeridiem3.Text = null; this.colAnteMeridiem4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem4.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem4.DataPropertyName = "AnteMeridiem4"; this.colAnteMeridiem4.FillWeight = 94.38452f; this.colAnteMeridiem4.HeaderText = "上午"; this.colAnteMeridiem4.Name = "colAnteMeridiem4"; this.colAnteMeridiem4.ReadOnly = true; this.colAnteMeridiem4.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem4.Text = null; this.colPostMeridiem4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem4.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem4.DataPropertyName = "PostMeridiem4"; this.colPostMeridiem4.FillWeight = 94.38452f; this.colPostMeridiem4.HeaderText = "下午"; this.colPostMeridiem4.Name = "colPostMeridiem4"; this.colPostMeridiem4.ReadOnly = true; this.colPostMeridiem4.Style = eDotNetBarStyle.StyleManagerControlled; this.colPostMeridiem4.Text = null; this.colAnteMeridiem5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem5.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem5.DataPropertyName = "AnteMeridiem5"; this.colAnteMeridiem5.FillWeight = 94.38452f; this.colAnteMeridiem5.HeaderText = "上午"; this.colAnteMeridiem5.Name = "colAnteMeridiem5"; this.colAnteMeridiem5.ReadOnly = true; this.colAnteMeridiem5.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem5.Text = null; this.colPostMeridiem5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem5.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem5.DataPropertyName = "PostMeridiem5"; this.colPostMeridiem5.FillWeight = 94.38452f; this.colPostMeridiem5.HeaderText = "下午"; this.colPostMeridiem5.Name = "colPostMeridiem5"; this.colPostMeridiem5.ReadOnly = true; this.colPostMeridiem5.Style = eDotNetBarStyle.StyleManagerControlled; this.colPostMeridiem5.Text = null; this.colAnteMeridiem6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem6.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem6.DataPropertyName = "AnteMeridiem6"; this.colAnteMeridiem6.FillWeight = 94.38452f; this.colAnteMeridiem6.HeaderText = "上午"; this.colAnteMeridiem6.Name = "colAnteMeridiem6"; this.colAnteMeridiem6.ReadOnly = true; this.colAnteMeridiem6.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem6.Text = null; this.colPostMeridiem6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem6.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem6.DataPropertyName = "PostMeridiem6"; this.colPostMeridiem6.FillWeight = 94.38452f; this.colPostMeridiem6.HeaderText = "下午"; this.colPostMeridiem6.Name = "colPostMeridiem6"; this.colPostMeridiem6.ReadOnly = true; this.colPostMeridiem6.Style = eDotNetBarStyle.StyleManagerControlled; this.colPostMeridiem6.Text = null; this.colAnteMeridiem7.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem7.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem7.DataPropertyName = "AnteMeridiem7"; this.colAnteMeridiem7.FillWeight = 94.38452f; this.colAnteMeridiem7.HeaderText = "上午"; this.colAnteMeridiem7.Name = "colAnteMeridiem7"; this.colAnteMeridiem7.ReadOnly = true; this.colAnteMeridiem7.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem7.Text = null; this.colPostMeridiem7.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem7.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem7.DataPropertyName = "PostMeridiem7"; this.colPostMeridiem7.FillWeight = 94.38452f; this.colPostMeridiem7.HeaderText = "下午"; this.colPostMeridiem7.Name = "colPostMeridiem7"; this.colPostMeridiem7.ReadOnly = true; this.colPostMeridiem7.Style = eDotNetBarStyle.StyleManagerControlled; this.colPostMeridiem7.Text = null; this.colAnteMeridiem8.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colAnteMeridiem8.ColorTable = eButtonColor.Office2007WithBackground; this.colAnteMeridiem8.DataPropertyName = "AnteMeridiem8"; this.colAnteMeridiem8.FillWeight = 94.38452f; this.colAnteMeridiem8.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.colAnteMeridiem8.HeaderText = "上午"; this.colAnteMeridiem8.Name = "colAnteMeridiem8"; this.colAnteMeridiem8.ReadOnly = true; this.colAnteMeridiem8.Style = eDotNetBarStyle.StyleManagerControlled; this.colAnteMeridiem8.Text = null; this.colPostMeridiem8.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.colPostMeridiem8.ColorTable = eButtonColor.Office2007WithBackground; this.colPostMeridiem8.DataPropertyName = "PostMeridiem8"; this.colPostMeridiem8.FillWeight = 94.38452f; this.colPostMeridiem8.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.colPostMeridiem8.HeaderText = "下午"; this.colPostMeridiem8.Name = "colPostMeridiem8"; this.colPostMeridiem8.ReadOnly = true; this.colPostMeridiem8.Style = eDotNetBarStyle.StyleManagerControlled; this.colPostMeridiem8.Text = null; this.tableLayoutPanel1.CausesValidation = false; this.tableLayoutPanel1.ColumnCount = 9; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20f)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 922f)); this.tableLayoutPanel1.Controls.Add(this.lbDate8, 8, 0); this.tableLayoutPanel1.Controls.Add(this.lbDate7, 7, 0); this.tableLayoutPanel1.Controls.Add(this.lbDate6, 6, 0); this.tableLayoutPanel1.Controls.Add(this.lbDate5, 5, 0); this.tableLayoutPanel1.Controls.Add(this.lbDate3, 3, 0); this.tableLayoutPanel1.Controls.Add(this.lbDate1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.labelX5, 0, 0); this.tableLayoutPanel1.Controls.Add(this.lbDate2, 1, 0); this.tableLayoutPanel1.Controls.Add(this.lbDate4, 4, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 123); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f)); this.tableLayoutPanel1.Size = new System.Drawing.Size(1082, 35); this.tableLayoutPanel1.TabIndex = 0; this.lbDate8.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate8.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate8.Location = new System.Drawing.Point(163, 3); this.lbDate8.Name = "lbDate8"; this.lbDate8.Size = new System.Drawing.Size(916, 29); this.lbDate8.TabIndex = 9; this.lbDate8.TextAlignment = System.Drawing.StringAlignment.Center; this.lbDate7.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate7.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate7.Location = new System.Drawing.Point(143, 3); this.lbDate7.Name = "lbDate7"; this.lbDate7.Size = new System.Drawing.Size(14, 29); this.lbDate7.TabIndex = 8; this.lbDate7.TextAlignment = System.Drawing.StringAlignment.Center; this.lbDate6.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate6.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate6.Location = new System.Drawing.Point(123, 3); this.lbDate6.Name = "lbDate6"; this.lbDate6.Size = new System.Drawing.Size(14, 29); this.lbDate6.TabIndex = 7; this.lbDate6.TextAlignment = System.Drawing.StringAlignment.Center; this.lbDate5.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate5.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate5.Location = new System.Drawing.Point(103, 3); this.lbDate5.Name = "lbDate5"; this.lbDate5.Size = new System.Drawing.Size(14, 29); this.lbDate5.TabIndex = 6; this.lbDate5.TextAlignment = System.Drawing.StringAlignment.Center; this.lbDate3.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate3.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate3.Location = new System.Drawing.Point(63, 3); this.lbDate3.Name = "lbDate3"; this.lbDate3.Size = new System.Drawing.Size(14, 29); this.lbDate3.TabIndex = 5; this.lbDate3.TextAlignment = System.Drawing.StringAlignment.Center; this.lbDate1.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate1.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate1.Location = new System.Drawing.Point(23, 3); this.lbDate1.Name = "lbDate1"; this.lbDate1.Size = new System.Drawing.Size(14, 29); this.lbDate1.TabIndex = 3; this.lbDate1.TextAlignment = System.Drawing.StringAlignment.Center; this.labelX5.BackgroundStyle.CornerType = eCornerType.Square; this.labelX5.Dock = System.Windows.Forms.DockStyle.Fill; this.labelX5.Location = new System.Drawing.Point(3, 3); this.labelX5.Name = "labelX5"; this.labelX5.Size = new System.Drawing.Size(14, 29); this.labelX5.TabIndex = 2; this.labelX5.TextAlignment = System.Drawing.StringAlignment.Center; this.lbDate2.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate2.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate2.Location = new System.Drawing.Point(43, 3); this.lbDate2.Name = "lbDate2"; this.lbDate2.Size = new System.Drawing.Size(14, 29); this.lbDate2.TabIndex = 0; this.lbDate2.TextAlignment = System.Drawing.StringAlignment.Center; this.lbDate4.BackgroundStyle.CornerType = eCornerType.Square; this.lbDate4.Dock = System.Windows.Forms.DockStyle.Fill; this.lbDate4.Location = new System.Drawing.Point(83, 3); this.lbDate4.Name = "lbDate4"; this.lbDate4.Size = new System.Drawing.Size(14, 29); this.lbDate4.TabIndex = 4; this.lbDate4.TextAlignment = System.Drawing.StringAlignment.Center; this.panelInfo.CanvasColor = System.Drawing.SystemColors.Control; this.panelInfo.ColorSchemeStyle = eDotNetBarStyle.StyleManagerControlled; this.panelInfo.DisabledBackColor = System.Drawing.Color.Empty; this.panelInfo.Dock = System.Windows.Forms.DockStyle.Top; this.panelInfo.Location = new System.Drawing.Point(0, 87); this.panelInfo.Name = "panelInfo"; this.panelInfo.Size = new System.Drawing.Size(1082, 36); this.panelInfo.Style.Alignment = System.Drawing.StringAlignment.Center; this.panelInfo.Style.BackColor1.Color = System.Drawing.Color.Transparent; this.panelInfo.Style.Font = new System.Drawing.Font("SimSun", 10.5f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134); this.panelInfo.Style.ForeColor.Color = System.Drawing.Color.FromArgb(192, 0, 0); this.panelInfo.Style.GradientAngle = 90; this.panelInfo.Style.WordWrap = true; this.panelInfo.TabIndex = 3; this.plPriority.CanvasColor = System.Drawing.SystemColors.Control; this.plPriority.ColorSchemeStyle = eDotNetBarStyle.StyleManagerControlled; this.plPriority.Controls.Add(this.itemPrioritys); this.plPriority.Controls.Add(this.labelX4); this.plPriority.DisabledBackColor = System.Drawing.Color.Empty; this.plPriority.Dock = System.Windows.Forms.DockStyle.Top; this.plPriority.Location = new System.Drawing.Point(0, 50); this.plPriority.Name = "plPriority"; this.plPriority.Size = new System.Drawing.Size(1082, 37); this.plPriority.Style.Alignment = System.Drawing.StringAlignment.Center; this.plPriority.Style.BackColor1.ColorSchemePart = eColorSchemePart.PanelBackground; this.plPriority.Style.Border = eBorderType.SingleLine; this.plPriority.Style.BorderColor.ColorSchemePart = eColorSchemePart.PanelBorder; this.plPriority.Style.ForeColor.ColorSchemePart = eColorSchemePart.PanelText; this.plPriority.Style.GradientAngle = 90; this.plPriority.TabIndex = 0; this.plPriority.Visible = false; this.itemPrioritys.AllowDrop = true; this.itemPrioritys.BackgroundStyle.Class = "ItemPanel"; this.itemPrioritys.BackgroundStyle.CornerType = eCornerType.Square; this.itemPrioritys.BackgroundStyle.Description = "这是一个测试"; this.itemPrioritys.BackgroundStyle.Name = "这是一个测试2"; this.itemPrioritys.ContainerControlProcessDialogKey = true; this.itemPrioritys.Dock = System.Windows.Forms.DockStyle.Fill; this.itemPrioritys.DragDropSupport = true; this.itemPrioritys.ItemSpacing = 5; this.itemPrioritys.Location = new System.Drawing.Point(97, 0); this.itemPrioritys.MultiLine = true; this.itemPrioritys.Name = "itemPrioritys"; this.itemPrioritys.Size = new System.Drawing.Size(985, 37); this.itemPrioritys.Style = eDotNetBarStyle.StyleManagerControlled; this.itemPrioritys.TabIndex = 1; this.itemPrioritys.Text = "测试下"; this.itemPrioritys.UseNativeDragDrop = true; this.itemPrioritys.ItemDoubleClick += new System.Windows.Forms.MouseEventHandler(this.itemPrioritys_ItemDoubleClick); this.itemPrioritys.DragDrop += new System.Windows.Forms.DragEventHandler(this.itemPrioritys_DragDrop); this.itemPrioritys.DragEnter += new System.Windows.Forms.DragEventHandler(this.itemPrioritys_DragEnter); this.labelX4.BackgroundStyle.CornerType = eCornerType.Square; this.labelX4.Dock = System.Windows.Forms.DockStyle.Left; this.labelX4.Location = new System.Drawing.Point(0, 0); this.labelX4.Name = "labelX4"; this.labelX4.Size = new System.Drawing.Size(97, 37); this.labelX4.TabIndex = 0; this.labelX4.Text = "医生优先级:"; this.labelX4.TextAlignment = System.Drawing.StringAlignment.Center; this.panelEx2.CanvasColor = System.Drawing.SystemColors.Control; this.panelEx2.ColorSchemeStyle = eDotNetBarStyle.StyleManagerControlled; this.panelEx2.Controls.Add(this.btnSwitch); this.panelEx2.Controls.Add(this.chkWaitforTime); this.panelEx2.Controls.Add(this.cmbDepartment); this.panelEx2.Controls.Add(this.labelX3); this.panelEx2.Controls.Add(this.cmbHospital); this.panelEx2.Controls.Add(this.labelX2); this.panelEx2.Controls.Add(this.cmbArea); this.panelEx2.Controls.Add(this.labelX1); this.panelEx2.Controls.Add(this.btnRefresh); this.panelEx2.DisabledBackColor = System.Drawing.Color.Empty; this.panelEx2.Dock = System.Windows.Forms.DockStyle.Top; this.panelEx2.Location = new System.Drawing.Point(0, 0); this.panelEx2.Name = "panelEx2"; this.panelEx2.Size = new System.Drawing.Size(1082, 50); this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center; this.panelEx2.Style.BackColor1.ColorSchemePart = eColorSchemePart.PanelBackground; this.panelEx2.Style.Border = eBorderType.SingleLine; this.panelEx2.Style.BorderColor.ColorSchemePart = eColorSchemePart.PanelBorder; this.panelEx2.Style.ForeColor.ColorSchemePart = eColorSchemePart.PanelText; this.panelEx2.Style.GradientAngle = 90; this.panelEx2.TabIndex = 0; this.btnSwitch.BackgroundStyle.CornerType = eCornerType.Square; this.btnSwitch.Enabled = false; this.btnSwitch.Location = new System.Drawing.Point(800, 24); this.btnSwitch.Name = "btnSwitch"; this.btnSwitch.OffText = "隐藏优先级"; this.btnSwitch.OnText = "展开优先级"; this.btnSwitch.Size = new System.Drawing.Size(110, 22); this.btnSwitch.Style = eDotNetBarStyle.StyleManagerControlled; this.btnSwitch.TabIndex = 8; this.btnSwitch.ValueChanged += new System.EventHandler(this.btnSwitch_ValueChanged); this.chkWaitforTime.BackgroundStyle.CornerType = eCornerType.Square; this.chkWaitforTime.FocusCuesEnabled = false; this.chkWaitforTime.Location = new System.Drawing.Point(801, 1); this.chkWaitforTime.Name = "chkWaitforTime"; this.chkWaitforTime.Size = new System.Drawing.Size(109, 23); this.chkWaitforTime.Style = eDotNetBarStyle.StyleManagerControlled; this.chkWaitforTime.TabIndex = 6; this.chkWaitforTime.Text = "静候放票"; this.chkWaitforTime.CheckedChanged += new System.EventHandler(this.chkWaitforTime_CheckedChanged); this.cmbDepartment.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.cmbDepartment.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.cmbDepartment.DisplayMember = "Text"; this.cmbDepartment.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.cmbDepartment.FormattingEnabled = true; this.cmbDepartment.ItemHeight = 15; this.cmbDepartment.Location = new System.Drawing.Point(545, 16); this.cmbDepartment.Name = "cmbDepartment"; this.cmbDepartment.Size = new System.Drawing.Size(238, 21); this.cmbDepartment.Style = eDotNetBarStyle.StyleManagerControlled; this.cmbDepartment.TabIndex = 5; this.cmbDepartment.SelectedIndexChanged += new System.EventHandler(this.cmbDepartment_SelectedIndexChanged); this.labelX3.BackgroundStyle.CornerType = eCornerType.Square; this.labelX3.Location = new System.Drawing.Point(504, 16); this.labelX3.Name = "labelX3"; this.labelX3.Size = new System.Drawing.Size(49, 23); this.labelX3.TabIndex = 4; this.labelX3.Text = "科室:"; this.cmbHospital.DisplayMember = "Text"; this.cmbHospital.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.cmbHospital.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbHospital.FormattingEnabled = true; this.cmbHospital.ItemHeight = 15; this.cmbHospital.Location = new System.Drawing.Point(206, 15); this.cmbHospital.Name = "cmbHospital"; this.cmbHospital.Size = new System.Drawing.Size(272, 21); this.cmbHospital.Style = eDotNetBarStyle.StyleManagerControlled; this.cmbHospital.TabIndex = 2; this.cmbHospital.SelectedIndexChanged += new System.EventHandler(this.cmbHospital_SelectedIndexChanged); this.labelX2.BackgroundStyle.CornerType = eCornerType.Square; this.labelX2.Location = new System.Drawing.Point(167, 15); this.labelX2.Name = "labelX2"; this.labelX2.Size = new System.Drawing.Size(49, 23); this.labelX2.TabIndex = 3; this.labelX2.Text = "医院:"; this.cmbArea.DisplayMember = "Text"; this.cmbArea.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.cmbArea.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbArea.FormattingEnabled = true; this.cmbArea.ItemHeight = 15; this.cmbArea.Location = new System.Drawing.Point(62, 15); this.cmbArea.Name = "cmbArea"; this.cmbArea.Size = new System.Drawing.Size(79, 21); this.cmbArea.Style = eDotNetBarStyle.StyleManagerControlled; this.cmbArea.TabIndex = 1; this.cmbArea.DropDown += new System.EventHandler(this.cmbArea_DropDown); this.cmbArea.SelectedIndexChanged += new System.EventHandler(this.cmbArea_SelectedIndexChanged); this.labelX1.BackgroundStyle.CornerType = eCornerType.Square; this.labelX1.Location = new System.Drawing.Point(19, 15); this.labelX1.Name = "labelX1"; this.labelX1.Size = new System.Drawing.Size(49, 23); this.labelX1.TabIndex = 1; this.labelX1.Text = "地区:"; this.btnRefresh.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnRefresh.ColorTable = eButtonColor.OrangeWithBackground; this.btnRefresh.Dock = System.Windows.Forms.DockStyle.Right; this.btnRefresh.Font = new System.Drawing.Font("SimSun", 14.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.btnRefresh.Location = new System.Drawing.Point(992, 0); this.btnRefresh.Name = "btnRefresh"; this.btnRefresh.Size = new System.Drawing.Size(90, 50); this.btnRefresh.Style = eDotNetBarStyle.StyleManagerControlled; this.btnRefresh.TabIndex = 0; this.btnRefresh.Text = "刷新"; this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.Controls.Add(this.panelEx1); base.Name = "RegisterControl"; base.Size = new System.Drawing.Size(1082, 504); base.SizeChanged += new System.EventHandler(this.RegisterControl_SizeChanged); this.panelEx1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)this.dataGridViewX1).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); this.plPriority.ResumeLayout(false); this.panelEx2.ResumeLayout(false); base.ResumeLayout(false); }
private void initForm() { String rangeTimeStr = "平成" + (this.fromDate_.Year - 1988) + "年" + this.fromDate_.Month + "月" + this.fromDate_.Day + "日" + "(" + jaWeekday["" + this.fromDate_.DayOfWeek] + ")"; rangeTimeStr += " ~ " + this.toDate_.Month + "月" + this.toDate_.Day + "日" + "(" + jaWeekday["" + this.toDate_.DayOfWeek] + ")"; lbTimeRange.Text = rangeTimeStr; //Add day DateTime date = this.fromDate_; while (date <= this.toDate_) { //datagridview DataGridViewLabelXColumn cl = new DataGridViewLabelXColumn(); cl.HeaderText = date.Day + "\n" + "(" + jaWeekday["" + date.DayOfWeek] + ")"; cl.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; cl.HeaderCell.Style.Font = new Font("Meiryo", 7.5F, FontStyle.Bold); cl.Width = 35; String wday = date.DayOfWeek.ToString(); if (wday == "Saturday") { cl.HeaderCell.Style.ForeColor = Color.Blue; cl.HeaderCell.Style.BackColor = Color.Blue; } else if (wday == "Sunday") { cl.HeaderCell.Style.ForeColor = Color.Red; cl.HeaderCell.Style.BackColor = Color.Red; cl.DefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#D4C1D0"); } dgvStaff.Columns.Add(cl); date = date.AddDays(1); } }
private void initForm() { //school name int school_id = VariableGlobal.school_id; var school = (from p in db.CpSchools where p.Id == school_id select p).SingleOrDefault(); this.lblSchoolName.Text = school.Code.Trim() + ". " + school.Name; //Add day DateTime date = this.fromDate; while (date <= this.toDate) { //datagridview DataGridViewLabelXColumn cl = new DataGridViewLabelXColumn(); cl.HeaderText = date.Day + "\n" + "(" + jaWeekday["" + date.DayOfWeek] + ")"; cl.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; cl.HeaderCell.Style.Font = new Font("Meiryo", 7.5F, FontStyle.Bold); cl.Width = 35; String wday = date.DayOfWeek.ToString(); if (wday == "Saturday") { cl.HeaderCell.Style.ForeColor = Color.Blue; cl.HeaderCell.Style.BackColor = Color.Blue; } else if (wday == "Sunday") { cl.HeaderCell.Style.ForeColor = Color.Red; cl.HeaderCell.Style.BackColor = Color.Red; cl.DefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#D4C1D0"); } dgvSchedule.Columns.Add(cl); date = date.AddDays(1); } //timezone color tzColors = new String[100]; tzShortName = new String[100]; timezoneIDs = this.frmp.getSelectedTzId(); for (int i = 0; i < timezoneIDs.Length; i++) { int tzind = timezoneIDs[i]; var tz = (from p in db.CpTimeZones where p.Id == tzind select p).FirstOrDefault(); tzColors[i] = tz.Color; tzShortName[i] = tz.Abbreviation; int ind = dgvTimezone.Rows.Add("", tz.Abbreviation, ((DateTime)tz.StartTime).ToString("t") + "~" + ((DateTime)tz.EndTime).ToString("t")); dgvTimezone.Rows[ind].Cells[0].Style.BackColor = System.Drawing.ColorTranslator.FromHtml(tz.Color); } this.Width = 1000; this.Height = 600; dgvTimezone.ClearSelection(); //Schedule click dgvSchedule.CellMouseClick += dgvSchedule_CellMouseClick; }