发布于 2015-01-29 12:03:31
15楼
#include "apdefap.h" //加载头文件
void Click(char* lpszPictureName, char* lpszObjectName ) //定义函数click()参数是两个指针,
{
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction DMTagName
// next TagID : 1
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction PictureName
// next PicID : 1
#define ApcCtlValvePopup_pdl "CtlValvePopup.pdl"
// WINCC:PICNAME_SECTION_END
char PictureWindow_Name[25], *ptrPictureWindow, *ptrVarName;
long int OffsetLeft, OffsetTop;
//显示名称
sprintf(PictureWindow_Name, "PictureWindow%s",lpszObjectName);
ptrPictureWindow = PictureWindow_Name;
//取得控件的左上角位置
OffsetTop= GetTop(lpszPictureName,lpszObjectName); //Return-Type: long int
OffsetLeft= GetLeft(lpszPictureName,lpszObjectName); //Return-Type: long int
//设置宽和高
//SetHeight(lpszPictureName,ptrPictureWindow,360); //Return-Type :BOOL
//SetWidth(lpszPictureName,ptrPictureWindow,650); //Return-Type :BOOL
//根据控件位置设置新位置
if (OffsetTop <420) SetTop(lpszPictureName,ptrPictureWindow,OffsetTop+40);
else SetTop(lpszPictureName,ptrPictureWindow,OffsetTop-100);
if (OffsetLeft <307) SetLeft(lpszPictureName,ptrPictureWindow,10);
else if (OffsetLeft >907) SetLeft(lpszPictureName,ptrPictureWindow,1280-650-20);
else SetLeft(lpszPictureName,ptrPictureWindow,OffsetLeft-300);
SetPictureName(lpszPictureName,ptrPictureWindow,ApcCtlValvePopup_pdl); //Return-Type :BOOL
//设置控件可见
SetVisible(lpszPictureName,ptrPictureWindow,1); //Return-Type :BOOL
}