以下脚本输出应用程序的一般屏幕信息。使用的命令不在官方文档中,不知道是否在所有GMS版本中都有效。
ClearResults()
number nScreens = CountScreens()
Result("System info on screens and application window.\n")
Result("**********************************************\n")
Result("\n Number of Screens: " + nScreens )
for( number i=0; i<nScreens; i++ )
{
string name = ScreenGetName(i)
Result("\n\n\t Screen #"+i+": "+name)
number st,sl,sb,sr
ScreenGetBounds(i,st,sl,sb,sr)
Result("\n\t\t Bounds: ["+st+";"+sl+";"+sb+";"+sr+"]")
number wt,wl,wb,wr
ScreenGetWorkArea(i,wt,wl,wb,wr)
Result("\n\t\t Work area: ["+wt+";"+wl+";"+wb+";"+wr+"]")
}
Result("\n\n GMS Application window:\n")
number ap_global_x,ap_global_y
ApplicationGetOrigin(ap_global_x,ap_global_y)
result("\n\t Origin(global coordinates): "+ap_global_x+"/"+ap_global_y)
number ap_t, ap_l, ap_b, ap_r
ApplicationGetBounds(ap_t, ap_l, ap_b, ap_r)
Result("\n\t Main area (application coordiantes): ["+ap_t+";"+ap_l+";"+ap_b+";"+ap_r+"]")
要找出工作区的哪些区域可以实际用于图像,您可以使用
GetMaximalDocumentWindowRect() 命令。
options 参数是一个数字,以二进制形式指定各种标志。
INSIDE_APPLICATION = 0x00000001 // 1
EXCLUDE_FRAME = 0x00000002 // 2
EXCLUDE_DOCKED_FLOATING_WINDOWS = 0x000000F0 // 240 (Sum 16+32+64+128)
例如获取由停靠窗口限制在所有四个侧面的区域
但忽略帧:
OPTION = 1+16+32+64+128 = 241
由于任何文档都可以部分或完全在可见工作区区域之外,使用不带INSIDE_APPLICATION 标志的此命令可为文档窗口提供完整的可用“虚拟”空间。
您可以使用以下脚本:
void Output( number OPTION , number DRAW)
{
Number T,L,B,R // coordinates
GetMaximalDocumentWindowRect(OPTION,t,l,b,r)
string z = "000000000000"
Result("\n ("+left( z, 10-len(Binary(OPTION))) + Binary(OPTION)+")")
Result("\t Coordintates: ["+Format(t,"%6d")+","+Format(l,"%6d")+","+Format(b,"%6d")+","+Format(r,"%6d")+"]")
if (DRAW)
NewScriptWindow("Test area ("+OPTION+")",t,l,b,r)
}
number DRAWIT = !TwoButtonDialog( "Output current maximum size to results.", "OK", "Also draw windows")
Output(1+2,DRAWIT) ; result("\t Maximum window, exclude frame")
Output(1+2+240,DRAWIT) ; result("\t Maximum window, limited by docked, exclude frame")