如何用多个变量给一个矩形物体改变不同的坐标?例如:用三个变量,TANK1、TANK2、TANK3给一个矩形物体改变成250、350、450的坐标。
以下方法比较笨,请高手指点。
#include "apdefap.h"
long _main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 3
#define TAG_1 "TANK1"
#define TAG_2 "TANK2"
#define TAG_3 "TANK3"
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END
if ((unsigned long)GetTagDouble (TAG_1))
return 250;
if ((unsigned long)GetTagDouble (TAG_1)+(unsigned long)GetTagDouble (TAG_2))
return 350;
if ((unsigned long)GetTagDouble (TAG_1)+(unsigned long)GetTagDouble (TAG_2)+(unsigned long)GetTagDouble (TAG_3))
return 450;
else
return 210;
}