protected override void OnPaint(PaintEventArgs e) { if (bmp == null || (bmp.Width != this.ClientSize.Width || bmp.Height != this.ClientSize.Height)) { bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height); this.Region = DrawStuff.DoRegion(this.ClientSize.Width, this.ClientSize.Height); } Graphics g = Graphics.FromImage(bmp); Color bg = Color.FromArgb(255, 7, 47, 0); this.BackColor = bg; g.FillRectangle(new SolidBrush(bg), 0, 0, this.ClientSize.Width, this.ClientSize.Height); Pen lg, ng, dg; lg = new Pen(Color.FromArgb(255, 7, 70, 0)); ng = new Pen(Color.FromArgb(255, 7, 50, 0)); dg = new Pen(Color.FromArgb(255, 7, 30, 0)); { Pen tmp; tmp = lg; lg = dg; dg = tmp; } DrawStuff.DrawHatchedBackground(g, this.ClientSize.Width, this.ClientSize.Height, 10, lg, ng, dg); Pen p = new Pen(Color.FromArgb(255, 14, 65, 0), 6); DrawStuff.DrawArcBorder(g, this.ClientSize.Width, this.ClientSize.Height, 3, p); p = new Pen(Color.Goldenrod, 2); DrawStuff.DrawArcBorder(g, this.ClientSize.Width, this.ClientSize.Height, 0, p); Font fnt = new System.Drawing.Font("MS Sans Serif", 8.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); DrawStuff.DrawTextShadow(g, "GMT", fnt, Brushes.Goldenrod, txtOffset.Left + txtOffset.Width + 10, txtOffset.Top + 3); DrawStuff.DrawTextShadowLeft(g, "Name", fnt, Brushes.Goldenrod, txtName.Top, txtName.Left - 5, txtName.Height); DrawStuff.DrawTextShadowLeft(g, "Offset", fnt, Brushes.Goldenrod, txtOffset.Top, txtOffset.Left - 5, txtOffset.Height); DrawStuff.DrawTextShadowLeft(g, "DST", fnt, Brushes.Goldenrod, chkDST.Top, chkDST.Left - 5, chkDST.Height); e.Graphics.DrawImage(bmp, 0, 0); }
protected override void OnPaint(PaintEventArgs e) { if (this.ClientSize.Height != (30 + lst.Count * 20 + 100 + 20)) { int offset = this.Height - this.ClientSize.Height; this.Height = (30 + lst.Count * 20 + 100 + 20) + offset; cmdExit.Top = this.Height - 10 - cmdExit.Height; cmdAdd.Top = cmdExit.Top - 10 - cmdAdd.Height; cmdExit.Left = this.Width - cmdExit.Width - 10; cmdAdd.Left = cmdExit.Left; } if (bmp == null || (bmp.Width != this.ClientSize.Width || bmp.Height != this.ClientSize.Height)) { bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height); this.Region = DrawStuff.DoRegion(this.ClientSize.Width, this.ClientSize.Height); } Graphics g = Graphics.FromImage(bmp); Color bg = Color.FromArgb(255, 7, 47, 0); this.BackColor = bg; g.FillRectangle(new SolidBrush(bg), 0, 0, this.ClientSize.Width, this.ClientSize.Height); Pen lg, ng, dg; lg = new Pen(Color.FromArgb(255, 7, 70, 0)); ng = new Pen(Color.FromArgb(255, 7, 50, 0)); dg = new Pen(Color.FromArgb(255, 7, 30, 0)); { Pen tmp; tmp = lg; lg = dg; dg = tmp; } DrawStuff.DrawHatchedBackground(g, this.ClientSize.Width, this.ClientSize.Height, 10, lg, ng, dg); Pen p = new Pen(Color.FromArgb(255, 14, 65, 0), 6); DrawStuff.DrawArcBorder(g, this.ClientSize.Width, this.ClientSize.Height, 3, p); p = new Pen(Color.Goldenrod, 2); DrawStuff.DrawArcBorder(g, this.ClientSize.Width, this.ClientSize.Height, 0, p); Font fnt = new System.Drawing.Font("MS Sans Serif", 8.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); DateTime now = DateTime.Now; int i = 0; foreach (TimeItem itm in lst) { DateTime newtime = now.ToUniversalTime().AddHours(itm.Offset); if (itm.DST) { bool bDST = DSTTime.Get.Offset(now); if (bDST) { newtime = newtime.AddHours(1); } } DrawStuff.DrawTextShadowLeft(g, itm.Name, fnt, Brushes.Goldenrod, 20 + i * 20, 100, 0); DrawStuff.DrawTextShadow(g, newtime.ToString("HH:mm:ss fffffff"), fnt, Brushes.Goldenrod, 110, 20 + i * 20); if ((i + 1) == Button_num) { DrawStuff.DrawTextShadow(g, "Remove", fnt, Brushes.Gold, 110 + 120, 20 + i * 20); } else { DrawStuff.DrawTextShadow(g, "Remove", fnt, Brushes.LightGreen, 110 + 120, 20 + i * 20); } i++; } DrawSpinnyClock(g, now, 20, 30 + lst.Count * 20); e.Graphics.DrawImage(bmp, 0, 0); }