Пример #1
0
 /// <summary>
 /// OnPaintBackground
 /// </summary>
 /// <param name="e"></param>
 protected override void OnPaintBackground(PaintEventArgs e)
 {
         #if DESIGN
     // prevent designer artifacts
     e.Graphics.Clear(this.Parent.BackColor);
     needle.Draw(e.Graphics);
         #endif
 }
Пример #2
0
        /// <summary>
        /// OnPaint
        /// </summary>
        /// <param name="e">PaintEventArgs</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            // double buffer the output
            Bitmap   b = new Bitmap(bufferBitmap);
            Graphics g = Graphics.FromImage(b);

            DrawBezel(g);
            DrawLines(g);

            DrawValue(g);
            needle.Angle = valueAngle;
            needle.Draw(g);

            foreach (Lamp l in lamps)
            {
                if (l.Visible)
                {
                    l.Draw(g);
                }
            }

            // draw the gauge
            e.Graphics.DrawImage(b, 0, 0);

            // clean up
            b.Dispose();
            g.Dispose();
        }