/// <summary> /// Отрисовка иконки /// </summary> public void DrawIcon(Graphics g, int x, int y) { if (icon != null) { icon.Draw(g, new Rectangle(x, y, 16, 16), 1); } }
/// <summary> /// Отрисовка формы /// </summary> /// <param name="e"></param> protected override void OnPaint(PaintEventArgs e) { //base.OnPaint(e); Graphics g = e.Graphics; g.Clear(Color.FromArgb(50, 50, 50)); // Иконка boxIcon.Draw(g, new Rectangle(30, 30, 60, 60), 2); // Текст g.DrawString(labelText, Font, Brushes.Black, new RectangleF(121f, textLocation + 1, textSize.Width, textSize.Height)); g.DrawString(labelText, Font, Brushes.White, new RectangleF(120f, textLocation, textSize.Width, textSize.Height)); }
/// <summary> /// Отрисовка формы /// </summary> protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; g.Clear(Color.FromArgb(50, 50, 50)); if (hasError) { if (icon == null) { icon = new ShadowImage(ControlImages.dialogerror); } icon.Draw(g, new Rectangle(12, 72, 24, 24), 1); g.DrawString(errorText, Font, Brushes.Black, 43, 78); g.DrawString(errorText, Font, Brushes.White, 42, 77); } }