Integer li_controls,i
String ls_xbl,ls_ybl,ls_wbl,ls_hbl
This.Setredraw(false)
li_controls=upperbound(This.Control[])
FOR i=1 TO li_controls
CHOOSE CASE This.Control[i].TypeOf()
CASE checkbox!
icbx_obj=This.control[i]
of_getbl(icbx_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
icbx_obj.x=newwidth*real(ls_xbl)
icbx_obj.y=newheight*real(ls_ybl)
CASE radiobutton!
irb_obj=This.control[i]
of_getbl(irb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
irb_obj.x=newwidth*real(ls_xbl)
irb_obj.y=newheight*real(ls_ybl)
CASE commandbutton!
icb_obj=This.control[i]
of_getbl(icb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
icb_obj.x=newwidth*real(ls_xbl)
icb_obj.y=newheight*real(ls_ybl)
icb_obj.width=newwidth*real(ls_wbl)
icb_obj.height=newheight*real(ls_hbl)
CASE picture!
ip_obj=This.control[i]
of_getbl(ip_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
ip_obj.x=newwidth*real(ls_xbl)
ip_obj.y=newheight*real(ls_ybl)
ip_obj.width=newwidth*real(ls_wbl)
ip_obj.height=newheight*real(ls_hbl)
CASE datawindow!
idw_obj=This.control[i]
of_getbl(idw_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
idw_obj.x=newwidth*real(ls_xbl)
idw_obj.y=newheight*real(ls_ybl)
idw_obj.width=newwidth*real(ls_wbl)
idw_obj.height=newheight*real(ls_hbl)
CASE dropdownlistbox!
iddlb_obj=This.control[i]
of_getbl(iddlb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
iddlb_obj.x=newwidth*real(ls_xbl)
iddlb_obj.y=newheight*real(ls_ybl)
iddlb_obj.width=newwidth*real(ls_wbl)
CASE dropdownpicturelistbox!
iddplb_obj=This.control[i]
of_getbl(iddplb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
iddplb_obj.x=newwidth*real(ls_xbl)
iddplb_obj.y=newheight*real(ls_ybl)
iddplb_obj.width=newwidth*real(ls_wbl)
CASE listbox!
ilb_obj=This.control[i]
of_getbl(ilb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
ilb_obj.x=newwidth*real(ls_xbl)
ilb_obj.y=newheight*real(ls_ybl)
ilb_obj.width=newwidth*real(ls_wbl)
ilb_obj.height=newheight*real(ls_hbl)
CASE multilineedit!
imle_obj=This.control[i]
of_getbl(imle_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
imle_obj.x=newwidth*real(ls_xbl)
imle_obj.y=newheight*real(ls_ybl)
imle_obj.width=newwidth*real(ls_wbl)
imle_obj.height=newheight*real(ls_hbl)
CASE editmask!
iem_obj=This.control[i]
of_getbl(iem_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
iem_obj.x=newwidth*real(ls_xbl)
iem_obj.y=newheight*real(ls_ybl)
iem_obj.width=newwidth*real(ls_wbl)
iem_obj.height=newheight*real(ls_hbl)
CASE tab!
it_obj=This.control[i]
of_getbl(it_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
it_obj.x=newwidth*real(ls_xbl)
it_obj.y=newheight*real(ls_ybl)
it_obj.width=newwidth*real(ls_wbl)
it_obj.height=newheight*real(ls_hbl)
CASE groupbox!
igb_obj=This.control[i]
of_getbl(igb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
igb_obj.x=newwidth*real(ls_xbl)
igb_obj.y=newheight*real(ls_ybl)
igb_obj.width=newwidth*real(ls_wbl)
igb_obj.height=newheight*real(ls_hbl)
CASE hscrollbar!
ihsb_obj=This.control[i]
of_getbl(ihsb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
ihsb_obj.x=newwidth*real(ls_xbl)
ihsb_obj.y=newheight*real(ls_ybl)
ihsb_obj.width=newwidth*real(ls_wbl)
ihsb_obj.height=newheight*real(ls_hbl)
CASE picturebutton!
ipb_obj=This.control[i]
of_getbl(ipb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
ipb_obj.x=newwidth*real(ls_xbl)
ipb_obj.y=newheight*real(ls_ybl)
ipb_obj.width=newwidth*real(ls_wbl)
ipb_obj.height=newheight*real(ls_hbl)
CASE listview!
ilv_obj=This.control[i]
of_getbl(ilv_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
ilv_obj.x=newwidth*real(ls_xbl)
ilv_obj.y=newheight*real(ls_ybl)
ilv_obj.width=newwidth*real(ls_wbl)
ilv_obj.height=newheight*real(ls_hbl)
CASE picturelistbox!
iplb_obj=This.control[i]
of_getbl(iplb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
iplb_obj.x=newwidth*real(ls_xbl)
iplb_obj.y=newheight*real(ls_ybl)
iplb_obj.width=newwidth*real(ls_wbl)
iplb_obj.height=newheight*real(ls_hbl)
CASE singlelineedit!
isle_obj=This.control[i]
of_getbl(isle_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
isle_obj.x=newwidth*real(ls_xbl)
isle_obj.y=newheight*real(ls_ybl)
isle_obj.width=newwidth*real(ls_wbl)
isle_obj.height=newheight*real(ls_hbl)
CASE treeview!
itv_obj=This.control[i]
of_getbl(itv_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
itv_obj.x=newwidth*real(ls_xbl)
itv_obj.y=newheight*real(ls_ybl)
itv_obj.width=newwidth*real(ls_wbl)
itv_obj.height=newheight*real(ls_hbl)
CASE userobject!
iuo_obj=This.control[i]
of_getbl(iuo_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
iuo_obj.x=newwidth*real(ls_xbl)
iuo_obj.y=newheight*real(ls_ybl)
iuo_obj.width=newwidth*real(ls_wbl)
iuo_obj.height=newheight*real(ls_hbl)
CASE vscrollbar!
ivsb_obj=This.control[i]
of_getbl(ivsb_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
ivsb_obj.x=newwidth*real(ls_xbl)
ivsb_obj.y=newheight*real(ls_ybl)
ivsb_obj.width=newwidth*real(ls_wbl)
ivsb_obj.height=newheight*real(ls_hbl)
CASE graph!
igr_obj=This.control[i]
of_getbl(igr_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
igr_obj.x=newwidth*real(ls_xbl)
igr_obj.y=newheight*real(ls_ybl)
igr_obj.width=newwidth*real(ls_wbl)
igr_obj.height=newheight*real(ls_hbl)
CASE olecontrol!
iole_obj=This.control[i]
of_getbl(iole_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
iole_obj.x=newwidth*real(ls_xbl)
iole_obj.y=newheight*real(ls_ybl)
iole_obj.width=newwidth*real(ls_wbl)
iole_obj.height=newheight*real(ls_hbl)
CASE richtextedit!
irte_obj=This.control[i]
of_getbl(irte_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
irte_obj.x=newwidth*real(ls_xbl)
irte_obj.y=newheight*real(ls_ybl)
irte_obj.width=newwidth*real(ls_wbl)
irte_obj.height=newheight*real(ls_hbl)
CASE statictext!
ist_obj=This.control[i]
of_getbl(ist_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
ist_obj.x=newwidth*real(ls_xbl)
ist_obj.y=newheight*real(ls_ybl)
ist_obj.width=newwidth*real(ls_wbl)
CASE line!
iln_obj=This.control[i]
of_getbl(iln_obj.tag,ls_xbl,ls_ybl,ls_wbl,ls_hbl)
iln_obj.beginx=newwidth*real(ls_xbl)
iln_obj.beginy=newheight*real(ls_ybl)
iln_obj.endx=newwidth*real(ls_wbl)
iln_obj.endy=newheight*real(ls_hbl)
END CHOOSE
NEXT
This.Setredraw(true)
uj5u.com熱心網友回復:
調整表單內所有控制元件的大小 位置uj5u.com熱心網友回復:
Resize 當用戶或程式打開或重設視窗大小時觸發所以里面的代碼就是調整表單內控制元件的大小和位置
uj5u.com熱心網友回復:
+1uj5u.com熱心網友回復:
+1uj5u.com熱心網友回復:
通篇代碼,雖然代碼挺多,但是意思就調整各個控制元件的X Y WIDTH HEIGH按鈕、圖片、DW、串列、滾動條等等控制元件
uj5u.com熱心網友回復:
哦 謝謝了 還有 我打包的時候有個問題http://wenwen.soso.com/z/q127947175.htm跟這個問題一樣 這是怎么回事???uj5u.com熱心網友回復:
調整螢屏的百分比,適合于你打開電腦的螢屏,注釋掉的時候會發現你運行起來的界面只是你layout的大小uj5u.com熱心網友回復:
調整控制元件位置和大小。。。。uj5u.com熱心網友回復:
控制元件自適應視窗大小,配合使用的應該還有一個UE_control_size(此自定義事件名稱可以自行定義,正確參考即可)事件,將此視窗保存為父視窗,以后其它視窗直接繼承就可以使視窗內的所有控制元件自適應視窗大小并按規則排放。但是在PB中有問題,超過10個以上(不包含10個)的控制元件定義必然報錯,我試了PB6.5-PB10.5的所有版本,都存在這個問題。。。。視窗變數instance varibles定義如下
singlelineedit isle_obj
commandbutton icb_obj
datawindow idw_obj
statictext ist_obj
editmask iem_obj
checkbox icbx_obj
dropdownlistbox iddlb_obj
groupbox igb_obj
treeview itv_obj
listbox ilb_obj
這樣基本上常用到了幾個控制元件就都包含在內了。。。。如果
uj5u.com熱心網友回復:
縮放視窗大小時各控制元件自動調整位置和大小。轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/36589.html
標籤:腳本語言
