在不同分辨率下自动调整窗口中控件的位置和大小?

bad_boy2002 2002-09-09 09:52:33
在不同分辨率下自动调整窗口中控件的位置和大小?有没有类似的函数提供,提供线索者有赏!
help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!help!
...全文
86 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
qdyuan 2002-09-09
  • 打赏
  • 举报
回复
最好还是使用pfc继承
moweihua 2002-09-09
  • 打赏
  • 举报
回复
PFC提供了尺寸调整服务(n_cst_resize),相当好用!
this.of_SetResize(TRUE)
this.inv_resize.of_Register(对象,比例)
ok!花两天看一下它提供的例子,要写的代码相当少,一看就懂。

juwuyi 2002-09-09
  • 打赏
  • 举报
回复
能不能让菜单也随着频率的大小变动呢?
WorldMobile 2002-09-09
  • 打赏
  • 举报
回复
看一下PFC中的例子吧,里面有
balloonman2002 2002-09-09
  • 打赏
  • 举报
回复
程序中修改显示分辨率,执行结束再改回原设置。
修改分辨率代码:
Global External Function:
FUNCTION ulong GetPixel(ulong hwnd, long xpos, long ypos) LIBRARY "Gdi32.dll"
FUNCTION ulong SetPixel(ulong hwnd, long xpos, long ypos, ulong pcol) LIBRARY "Gdi32.dll"

Script:
long lx, ly
ulong rtn
ulong l_handle, l_device
lx = 100
ly = 100
l_handle = handle(w_main)
l_device = GetDC(l_handle)
rtn = GetPixel(l_device, 100, 100)
MessageBox("Position " + string(lx) + "," + string(ly),"Color = " + string(rtn))
SetPixel(l_device, lx, ly, 0) // This call will set the pixel at lx, ly to black.


emoam 2002-09-09
  • 打赏
  • 举报
回复
RESIZE事件
sandorn 2002-09-09
  • 打赏
  • 举报
回复
窗口的open事件下:
environment env
integer ii_ScreenWidth,ii_ScreenHeight
double WRadio,HRadio,Radio
integer ii_WinBolderWidth,ii_WinBolderHeight
getenvironment(env)
ii_WinBolderWidth=this.width - this.WorkSpaceWidth()//取得窗体的边框宽度
ii_WinBolderHeight=this.height - this.WorkSpaceHeight()
ii_ScreenWidth=env.screenwidth
ii_ScreenHeight=env.screenheight
//compute the radio that need be resize

WRadio=ii_ScreenWidth/800 //标准认为屏幕分辨率为800*600
HRadio=ii_ScreenHeight/600//计算出屏幕相对800*600分辨率的变化量
Radio=Min(WRadio,HRadio)
if Radio=1.0 then //if the screen is default 800*600
return 0
end if
this.hide()
this.width=(this.width - ii_WinBolderWidth)*Radio + ii_WinBolderWidth
this.height=(this.height - ii_WinBolderHeight)*Radio + ii_WinBolderHeight
integer i
dragobject temp//用于取各种控件

for i=1 to upperbound(this.control)
temp=this.control[i]//调整大小,位置
temp.width=temp.width*Radio
temp.x=temp.x*Radio
temp.y=temp.y*Radio
temp.Height=temp.Height*Radio
choose case typeof(temp)
case tab!
tab mtab
mtab=temp
mtab.textsize = mtab.textsize*Radio//设置字体
case commandbutton!
commandbutton cb
cb = temp
cb.textsize = cb.textsize*Radio

case singlelineedit!
singlelineedit sle
sle = temp
sle.textsize=sle.textsize*Radio
case editmask!
editmask em
em = temp
em.textsize = em.textsize*Radio

case statictext!
statictext st
st = temp
st.textsize = st.textsize*Radio

case datawindow! // datawindows get zoomed
datawindow dw
dw = temp
dw.Object.DataWindow.zoom = string(int(Radio*100))//注意DATAWINDOW与其它控件的不同

case picturebutton!
picturebutton pb
pb = temp
pb.textsize = pb.textsize*Radio

case checkbox!
checkbox cbx
cbx = temp
cbx.textsize = cbx.textsize*Radio

case dropdownlistbox!
dropdownlistbox ddlb
ddlb = temp
ddlb.textsize = ddlb.textsize*Radio

case groupbox!
groupbox gb
gb = temp
gb.textsize = gb.textsize*Radio

case listbox!
listbox lb
lb = temp
lb.textsize = lb.textsize*Radio

case multilineedit!
multilineedit mle
mle = temp
mle.textsize = mle.textsize*Radio

case radiobutton!
radiobutton rb
rb = temp
rb.textsize = rb.textsize*Radio

end choose
next
this.show()
return 0

weimin_wolf 2002-09-09
  • 打赏
  • 举报
回复
RESIZE事件
把位置和大小设成相对的就行了

604

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 控件与界面
社区管理员
  • 控件与界面社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧