private void DeseneazaCalendarul(Graphics g) { Font FONT_DESEN = IHMUtile.getFONT_DESEN(); Font FONT_DESEN_MIC = IHMUtile.getFONT_DESEN_MIC(); Font FONT_DESEN_BOLD = IHMUtile.getFONT_DESEN_BOLD(); //Desenam zilele if (this.lDataReferinta != CConstante.DataNula) { float lX1SuprafataUtila = 0; float lY1SuprafataUtila = 0; float lWUnitateOrizontala = this.ClientRectangle.Width / 7; float lHUnitateVerticala = 0; DateTime dataDeLuni = CUtil.GetDataZileiDeLuniDinSaptamanaData(this.lDataReferinta); this.lLunaAfisata = new ColectieZileLuna(); StructZileLuna ziLuna = StructZileLuna.Empty; //Fundalul calendarului este alb g.FillRectangle(Brushes.White, this.ClientRectangle); //Desenam denumirea lunii string numeLuna = CUtil.GetNumeLunaAn(this.lDataReferinta.Month); SizeF marimeLuna = g.MeasureString(numeLuna, FONT_DESEN); IHMUtile.ScrieInCentru(g, Brushes.SteelBlue, lX1SuprafataUtila, lY1SuprafataUtila, this.ClientRectangle.Width, marimeLuna.Height, numeLuna, FONT_DESEN); lY1SuprafataUtila += marimeLuna.Height; //Desenam zilele saptamanii using (Font fontNumeZi = new System.Drawing.Font("Arial", 8)) { SizeF marimeZi = g.MeasureString("Mi", FONT_DESEN); IHMUtile.ScrieInCentru(g, Brushes.DarkBlue, lX1SuprafataUtila, lY1SuprafataUtila, lWUnitateOrizontala, marimeZi.Height, CDL.iStomaLab.CConstante.ZileDinDouaLitere.Substring(0, 2), fontNumeZi); IHMUtile.ScrieInCentru(g, Brushes.DarkBlue, lX1SuprafataUtila + lWUnitateOrizontala, lY1SuprafataUtila, lWUnitateOrizontala, marimeZi.Height, CDL.iStomaLab.CConstante.ZileDinDouaLitere.Substring(2, 2), fontNumeZi); IHMUtile.ScrieInCentru(g, Brushes.DarkBlue, lX1SuprafataUtila + 2 * lWUnitateOrizontala, lY1SuprafataUtila, lWUnitateOrizontala, marimeZi.Height, CDL.iStomaLab.CConstante.ZileDinDouaLitere.Substring(4, 2), fontNumeZi); IHMUtile.ScrieInCentru(g, Brushes.DarkBlue, lX1SuprafataUtila + 3 * lWUnitateOrizontala, lY1SuprafataUtila, lWUnitateOrizontala, marimeZi.Height, CDL.iStomaLab.CConstante.ZileDinDouaLitere.Substring(6, 2), fontNumeZi); IHMUtile.ScrieInCentru(g, Brushes.DarkBlue, lX1SuprafataUtila + 4 * lWUnitateOrizontala, lY1SuprafataUtila, lWUnitateOrizontala, marimeZi.Height, CDL.iStomaLab.CConstante.ZileDinDouaLitere.Substring(8, 2), fontNumeZi); IHMUtile.ScrieInCentru(g, Brushes.DarkBlue, lX1SuprafataUtila + 5 * lWUnitateOrizontala, lY1SuprafataUtila, lWUnitateOrizontala, marimeZi.Height, CDL.iStomaLab.CConstante.ZileDinDouaLitere.Substring(10, 2), fontNumeZi); IHMUtile.ScrieInCentru(g, Brushes.DarkBlue, lX1SuprafataUtila + 6 * lWUnitateOrizontala, lY1SuprafataUtila, lWUnitateOrizontala, marimeZi.Height, CDL.iStomaLab.CConstante.ZileDinDouaLitere.Substring(12), fontNumeZi); lY1SuprafataUtila += marimeZi.Height; } lHUnitateVerticala = (this.ClientRectangle.Height - lY1SuprafataUtila) / this.lNrSaptamani; //scriem datele in casutele corespunzatoare for (int i = 0; i < this.lNrSaptamani; i++) { do { ziLuna = new StructZileLuna(dataDeLuni, lX1SuprafataUtila + (((int)dataDeLuni.DayOfWeek + 6) % 7) * lWUnitateOrizontala, lY1SuprafataUtila + i * lHUnitateVerticala, lWUnitateOrizontala, lHUnitateVerticala, dataDeLuni.Month == this.lDataReferinta.Month, dataDeLuni.Month == this.lDataReferinta.Month && this.lListaDateSelectate.ContainsKey(dataDeLuni), dataDeLuni.Month == this.lDataReferinta.Month && this.lListaZileNelucratoare.Contains(dataDeLuni), this.lListaDateSelectate.ContainsKey(dataDeLuni) ? this.lListaDateSelectate[dataDeLuni].Item3 : string.Empty, this.lListaDateSelectate.ContainsKey(dataDeLuni) ? this.lListaDateSelectate[dataDeLuni].Item2 : 1); if (this.lListaDateSelectate.ContainsKey(dataDeLuni) && !this.lListaDateSelectate[dataDeLuni].Item1.IsEmpty) { if (string.IsNullOrEmpty(this.lListaDateSelectate[dataDeLuni].Item3)) { ziLuna.Deseneaza(g, FONT_DESEN, FONT_DESEN_MIC, this.lListaDateSelectate[dataDeLuni].Item1); } else { ziLuna.Deseneaza(g, FONT_DESEN_BOLD, FONT_DESEN_MIC, this.lListaDateSelectate[dataDeLuni].Item1); } } else { ziLuna.Deseneaza(g, FONT_DESEN, FONT_DESEN_MIC, this.lCuloareZiEvidentiata); } this.lLunaAfisata.Add(ziLuna); dataDeLuni = dataDeLuni.AddDays(1); } while (dataDeLuni.DayOfWeek != DayOfWeek.Monday); } } else { g.DrawString(this.Name, FONT_DESEN, Brushes.Black, 10, 10); } FONT_DESEN.Dispose(); FONT_DESEN = null; }