1,077
社区成员
发帖
与我相关
我的任务
分享
//p_2.width = 4000, p_2.height = 3000
long ll_pw, ll_ph, ll_pw_m, ll_ph_m
//转换为像素
ll_pw = unitstopixels(p_2.width, xunitstopixels!)
ll_ph = unitstopixels(p_2.height, yunitstopixels!)
ll_pw_m = unitstopixels(1000, xunitstopixels!)
ll_ph_m = unitstopixels(800, yunitstopixels!)
if (ll_pw / ll_ph) >= (ll_pw_m, ll_ph_m) then
ll_ph_m = ll_pw_m * (ll_ph/ll_pw) //宽为1000,高按比例改变
else
ll_pw_m = ll_ph_m * (ll_pw/ll_ph) //高为800,宽按比例改变
end if
//再转换为unit
p_1.width = pixelstounits(ll_pw_m, xpixelstounits!)
p_1.height = pixelstounits(ll_ph_m, ypixelstounits!)