/// <summary></summary> private void DrawMinutes(Graphics g) { Font font = new Font(FontFamily.GenericSansSerif, 8); //was msSans Font bfont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold); //was Arial g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit; //to make printing clearer DateTime hour; CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); string hFormat = Lan.GetShortTimeFormat(ci); string sTime; for (int i = 0; i < 24; i++) { hour = new DateTime(2000, 1, 1, i, 0, 0); //hour is the only important part of this time. sTime = hour.ToString(hFormat, ci); SizeF sizef = g.MeasureString(sTime, bfont); g.DrawString(sTime, bfont, new SolidBrush(Color.Black), TimeWidth - sizef.Width - 2, i * Lh * RowsPerHr + 1); g.DrawString(sTime, bfont, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + 1); if (MinPerIncr == 10) { g.DrawString(":10", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr); g.DrawString(":20", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr * 2); g.DrawString(":30", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr * 3); g.DrawString(":40", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr * 4); g.DrawString(":50", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr * 5); g.DrawString(":10", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr); g.DrawString(":20", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr * 2); g.DrawString(":30", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr * 3); g.DrawString(":40", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr * 4); g.DrawString(":50", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr * 5); } else //15 { g.DrawString(":15", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr); g.DrawString(":30", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr * 2); g.DrawString(":45", font, new SolidBrush(Color.Black) , TimeWidth - 19, i * Lh * RowsPerHr + Lh * RowsPerIncr * 3); g.DrawString(":15", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr); g.DrawString(":30", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr * 2); g.DrawString(":45", font, new SolidBrush(Color.Black) , TimeWidth + ColWidth * ColCount + ProvWidth * ProvCount, i * Lh * RowsPerHr + Lh * RowsPerIncr * 3); } } }
private void ContrSchedGrid_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { SolidBrush blockBrush = new SolidBrush(Color.White); float blockW = ColW; //set in each loop float opOffset = 0; if (SchedDefaults.List != null) { for (int i = 0; i < SchedDefaults.List.Length; i++) { if (SchedType == ScheduleType.Practice) //for practice { if (SchedDefaults.List[i].SchedType != ScheduleType.Practice) { continue; //only show practice blocks } } if (SchedType == ScheduleType.Provider) //for providers { if (SchedDefaults.List[i].SchedType != ScheduleType.Provider) { continue; //only show prov blocks } if (SchedDefaults.List[i].ProvNum != ProvNum) { continue; //only show blocks for this prov } } if (SchedType == ScheduleType.Blockout) //for blockouts //only show practice blocks and blockout blocks { if (SchedDefaults.List[i].SchedType == ScheduleType.Provider) { continue; } } if (SchedDefaults.List[i].SchedType == ScheduleType.Practice) //open block color { blockBrush = new SolidBrush(DefB.Long[(int)DefCat.AppointmentColors][0].ItemColor); blockW = ColW; opOffset = 0; } if (SchedDefaults.List[i].SchedType == ScheduleType.Provider) //open block color { blockBrush = new SolidBrush(DefB.Long[(int)DefCat.AppointmentColors][0].ItemColor); blockW = ColW; opOffset = 0; } if (SchedDefaults.List[i].SchedType == ScheduleType.Blockout) { blockBrush = new SolidBrush(DefB.GetColor(DefCat.BlockoutTypes , SchedDefaults.List[i].BlockoutType)); if (SchedDefaults.List[i].Op == 0) { blockW = ColW; } else { blockW = opW; } if (SchedDefaults.List[i].Op == 0) { opOffset = 0; } else { opOffset = Operatories.GetOrder(SchedDefaults.List[i].Op); if (opOffset == -1) //op not visible { continue; } opOffset = opOffset * opW; } } e.Graphics.FillRectangle(blockBrush , NumW + SchedDefaults.List[i].DayOfWeek * ColW + opOffset //usually 0 , SchedDefaults.List[i].StartTime.Hour * 6 * RowH + (int)SchedDefaults.List[i].StartTime.Minute / 10 * RowH , blockW , ((SchedDefaults.List[i].StopTime - SchedDefaults.List[i].StartTime).Hours * 6 + (SchedDefaults.List[i].StopTime - SchedDefaults.List[i].StartTime).Minutes / 10) * RowH); } } Pen bPen = new Pen(Color.Black); Pen gPen = new Pen(Color.LightGray); for (int y = 0; y < 24 * 6; y++) { e.Graphics.DrawLine(gPen, NumW, y * RowH, NumW + ColW * 7, y * RowH); } for (int y = 0; y < 25; y++) { e.Graphics.DrawLine(bPen, NumW, y * RowH * 6, NumW + ColW * 7, y * RowH * 6); } for (int x = 0; x < 8; x++) { e.Graphics.DrawLine(bPen, NumW + x * ColW, 0, NumW + x * ColW, RowH * 6 * 24); } if (SchedDefaults.List != null && SchedType == ScheduleType.Blockout) { for (int i = 0; i < SchedDefaults.List.Length; i++) { if (SchedDefaults.List[i].SchedType == ScheduleType.Blockout) { if (SchedDefaults.List[i].Op == 0) { blockW = ColW; } else { blockW = opW; } if (SchedDefaults.List[i].Op == 0) { opOffset = 0; } else { opOffset = Operatories.GetOrder(SchedDefaults.List[i].Op); if (opOffset == -1) //op not visible { continue; } opOffset = opOffset * opW; } e.Graphics.DrawString( DefB.GetName(DefCat.BlockoutTypes, SchedDefaults.List[i].BlockoutType) , blockFont, Brushes.Black , new RectangleF( NumW + SchedDefaults.List[i].DayOfWeek * ColW + opOffset //usually 0 , SchedDefaults.List[i].StartTime.Hour * 6 * RowH + (int)SchedDefaults.List[i].StartTime.Minute / 10 * RowH , blockW , 15)); } } } CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); string hFormat = Lan.GetShortTimeFormat(ci); for (int y = 0; y < 24; y++) { e.Graphics.DrawString((new DateTime(2000, 1, 1, y, 0, 0)).ToString(hFormat, ci) , timeFont, new SolidBrush(Color.Black), 0, y * RowH * 6 - 3); e.Graphics.DrawString((new DateTime(2000, 1, 1, y, 0, 0)).ToString(hFormat, ci) , timeFont, new SolidBrush(Color.Black), NumW + ColW * 7, y * RowH * 6 - 3); } Width = NumW * 2 + ColW * 7; Height = RowH * 24 * 6 + 1; }