画波兰线

private void DrawWave(Graphics g,Point start, Point end)
        {
            Pen pen = Pens.Red;
            if ((end.X - start.X) > 4)
            {
                var pl = new ArrayList();
                for (int i = start.X; i <= (end.X - 2); i += 4)
                {
                    pl.Add(new Point(i, start.Y));
                    pl.Add(new Point(i + 2, start.Y + 2));
                }
                Point[] p = (Point[])pl.ToArray(typeof(Point));
                g.DrawLines(pen, p);
            }
            else
            {
                g.DrawLine(pen, start, end);
            }
        }

        private void uC_SmartTagSupport1_Paint(object sender, PaintEventArgs e)
        {
            int y = (uC_SmartTagSupport1.Top + uC_SmartTagSupport1.Height - 1);
            int x = uC_SmartTagSupport1.Left;

            DrawWave(e.Graphics, new Point(1, uC_SmartTagSupport1.Height - 3), new Point(100, uC_SmartTagSupport1.Height - 3));
        }

  

posted @ 2014-01-23 23:08  perock  阅读(236)  评论(0编辑  收藏  举报