switch (Form) { case 1: p1 = CPoint(PositionS.x, PositionS.y); p2 = CPoint(PositionS.x + 48, PositionS.y); p3 = CPoint(PositionS.x + 61, PositionS.y); p4 = CPoint(PositionS.x + 100, PositionS.y); //p5 = CPoint(PositionS.x + 53, PositionS.y + 15); //p6 = CPoint(PositionS.x + 68, PositionS.y + 41); if (Status == 0) { p7 = CPoint(PositionS.x + 40, PositionS.y); p8 = CPoint(PositionS.x + 60, PositionS.y); } else if (Status == 1) { p7 = CPoint(PositionS.x + 49, PositionS.y + 5); p8 = CPoint(PositionS.x + 58, PositionS.y + 21); } break; case 2: p1 = CPoint(PositionS.x + 100, PositionS.y); p2 = CPoint(PositionS.x + 52, PositionS.y); p3 = CPoint(PositionS.x + 39, PositionS.y); p4 = CPoint(PositionS.x, PositionS.y); //p5 = CPoint(PositionS.x + 47, PositionS.y + 15); //p6 = CPoint(PositionS.x + 32, PositionS.y + 41); if (Status == 0) { p7 = CPoint(PositionS.x + 40, PositionS.y); p8 = CPoint(PositionS.x + 60, PositionS.y); } else if (Status == 1) { p7 = CPoint(PositionS.x + 51, PositionS.y + 5); p8 = CPoint(PositionS.x + 42, PositionS.y + 21); } break; case 3://11道岔 p1 = CPoint(PositionS.x, PositionS.y); p2 = CPoint(PositionS.x + 48, PositionS.y); p3 = CPoint(PositionS.x + 61, PositionS.y); p4 = CPoint(PositionS.x + 100, PositionS.y); p5 = CPoint(PositionS.x + 53, PositionS.y - 15); p6 = CPoint(PositionS.x + 68, PositionS.y - 41); if (Status == 0) { p7 = CPoint(PositionS.x + 40, PositionS.y); p8 = CPoint(PositionS.x + 60, PositionS.y); } else if (Status == 1) { p7 = CPoint(PositionS.x + 49, PositionS.y - 5); p8 = CPoint(PositionS.x + 58, PositionS.y - 21); } break; case 4://12道岔 p1 = CPoint(PositionS.x + 100, PositionS.y); p2 = CPoint(PositionS.x + 52, PositionS.y); p3 = CPoint(PositionS.x + 39, PositionS.y); p4 = CPoint(PositionS.x, PositionS.y); p5 = CPoint(PositionS.x + 47, PositionS.y - 15); p6 = CPoint(PositionS.x + 32, PositionS.y - 41); if (Status == 0) { p7 = CPoint(PositionS.x + 40, PositionS.y); p8 = CPoint(PositionS.x + 60, PositionS.y); } else if (Status == 1) { p7 = CPoint(PositionS.x + 51, PositionS.y - 5); p8 = CPoint(PositionS.x + 42, PositionS.y - 21); } break; }
时间: 2024-03-11 12:46:00 浏览: 105
VC基础知识总结多年积累
这段代码是一个switch语句,根据变量Form的值来给p1、p2、p3、p4、p5、p6、p7和p8赋不同的坐标值。其中,如果Form的值为1,则p1的坐标为(PositionS.x, PositionS.y),p2的坐标为(PositionS.x + 48, PositionS.y),p3的坐标为(PositionS.x + 61, PositionS.y),p4的坐标为(PositionS.x + 100, PositionS.y);如果Form的值为2,则p1的坐标为(PositionS.x + 100, PositionS.y),p2的坐标为(PositionS.x + 52, PositionS.y),p3的坐标为(PositionS.x + 39, PositionS.y),p4的坐标为(PositionS.x, PositionS.y);如果Form的值为3,则p1的坐标为(PositionS.x, PositionS.y),p2的坐标为(PositionS.x + 48, PositionS.y),p3的坐标为(PositionS.x + 61, PositionS.y),p4的坐标为(PositionS.x + 100, PositionS.y),p5的坐标为(PositionS.x + 53, PositionS.y - 15),p6的坐标为(PositionS.x + 68, PositionS.y - 41);如果Form的值为4,则p1的坐标为(PositionS.x + 100, PositionS.y),p2的坐标为(PositionS.x + 52, PositionS.y),p3的坐标为(PositionS.x + 39, PositionS.y),p4的坐标为(PositionS.x, PositionS.y),p5的坐标为(PositionS.x + 47, PositionS.y - 15),p6的坐标为(PositionS.x + 32, PositionS.y - 41)。根据Status的值不同,p7和p8也会有不同的坐标值。
阅读全文