Csharp/C Sharp/2D Graphics/SystemPens

Материал из .Net Framework эксперт
Версия от 14:41, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

FromSystemColor

<source lang="csharp">

using System; using System.Drawing; using System.Windows.Forms; class XMarksTheSpot : Form {

   public static void Main() {
       Application.Run(new XMarksTheSpot());
   }
   public XMarksTheSpot() {
       Text = "X Marks The Spot";
       ResizeRedraw = true;
   }
   protected override void OnPaint(PaintEventArgs pea) {
       Graphics grfx = pea.Graphics;
       Pen pen = SystemPens.FromSystemColor(SystemColors.ActiveBorder);
       grfx.DrawLine(pen, 0, 0,
                          ClientSize.Width - 1, ClientSize.Height - 1);
       grfx.DrawLine(pen, 0, ClientSize.Height - 1,
                          ClientSize.Width - 1, 0);
   }

}

</source>