日期:2014-05-18  浏览次数:20675 次

怎么样画有立体效果的矩形?
rt

------解决方案--------------------
C# code
        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            using(Pen pen = new Pen(new SolidBrush(Color.Red), 1))
            {
                Point p1 = new Point(0, 0);//  p1 ----------------p2
                Point p2 = new Point(30, 0);//   |\               \
                Point p3 = new Point(10, 30);//p7| p2---------------p4
                Point p4 = new Point(40, 30);//   \|               |
                Point p5 = new Point(10, 80);//    |               |p6
                Point p6 = new Point(40, 80);//  p5 ----------------
                Point p7 = new Point(0, 80 - 30);//p5的高度-p3的高度
                g.DrawLine(pen, p1, p2);
                g.DrawLine(pen, p3, p4);
                g.DrawLine(pen, p1, p3);
                g.DrawLine(pen, p2, p4);

                g.DrawLine(pen, p3, p5);
                g.DrawLine(pen, p4, p6);
                g.DrawLine(pen, p5, p6);

                g.DrawLine(pen, p1, p7);
                g.DrawLine(pen, p7, p5);

            }
        }