窗体和控件的自适应问题?

独行侠周游世界 2001-07-13 05:37:18
请教各位,我想不使用pfc,达到程序的窗体和其中的控件,包括dw,tr 所有的,都能够自适应系统,窗体的最大化,例如:800*600 互能够转化为640*480模式,所有的内容还能够正常显示,最好能够有一个函数,在windows 的show()或resize()调用解决这个问题,最好能有win98和winnt两个版本?请教大家,给介绍介绍你的思路,最好有实例源程序,学习学习,望大家不惜赐教,万分感谢! dekkerdillon@263.net
...全文
96 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
pbdesigner 2001-07-14
  • 打赏
  • 举报
回复
PB自带的Example上就有
咖啡 2001-07-13
  • 打赏
  • 举报
回复
pfc中不是有现成的吗?
wangsw 2001-07-13
  • 打赏
  • 举报
回复
够长的了!!
晕@-@
  • 打赏
  • 举报
回复
我有两个自己写的全局函数,可是....愿意奉上,但有要求,帮我研究研究,可不要得了东东,忘了本,adjustobject(dataobjet,l,windows,w)一个
int num_controls,index,a_num_controls,a_index,b_num_controls,b_index
dec rate
dec winnt
winnt = UnitsToPixels(350, XUnitsToPixels!)
rate = 76.0 / winnt
num_controls = UpperBound(w.control)
for index = 1 to num_controls
choose case typeof(w.control[index])
case singlelineedit!
singlelineedit s
s = w.control[index]
s.X = s.X * rate
s.Width = s.Width * rate
case datawindow!
datawindow d
d = w.control[index]
d.X = d.X * rate
d.Width = d.Width * rate

case commandbutton!
commandbutton c
c = w.control[index]
c.X = c.X * rate
c.Width = c.Width * rate
case treeview!
treeview t
t = w.control[index]
t.X = t.X * rate
t.Width = t.Width * rate
case groupbox!
groupbox g
g = w.control[index]
g.X = g.X * rate
g.Width = g.Width * rate
case checkbox!
checkbox k
k = w.control[index]
k.X = k.X * rate
k.Width = k.Width * rate
case statictext!
statictext sa
sa = w.control[index]
sa.X = sa.X * rate
sa.Width = sa.Width * rate
case editmask!
editmask mask
mask = w.control[index]
mask.X = mask.X * rate
mask.Width = mask.Width * rate
case picture!
picture p
p = w.control[index]
p.X = p.X * rate
p.Width = p.Width * rate
case dropdownlistbox!
dropdownlistbox drop
drop = w.control[index]
drop.X = drop.X * rate
drop.Width = drop.Width * rate
case tab!
tab ta
ta = w.control[index]
//adjustwindow(ta.control[1])
// a_num_controls = UpperBound(ta.control)
// for a_index = 1 to a_num_controls
// userobject u
// u = ta.control[a_index]
// b_num_controls = UpperBound(u.control)
// for b_index = 1 to b_num_controls
// windowobject win
// win = u.control[b_index]
// adjustwindow(win)
// next
// next
ta.X = ta.X * rate
ta.Width = ta.Width * rate
end choose
next
w.X = w.X * rate
if w.Width<2600 or w.Width>2700 then
w.Width = w.Width * rate
end if
if w.Width>2540 then
w.Width = 2557
end if
return

adjustwindow(...)
int num_controls,index,a_num_controls,a_index,b_num_controls,b_index
dec rate
dec winnt
environment env
GetEnvironment(env)
if Env.OSType = windowsnt! then
winnt = UnitsToPixels(350, XUnitsToPixels!)
rate = 76.0 / winnt
else
rate = 1.0
end if

num_controls = UpperBound(w.control)
for index = 1 to num_controls
choose case typeof(w.control[index])
case singlelineedit!
singlelineedit s
s = w.control[index]
s.X = s.X * rate
s.Width = s.Width * rate
case datawindow!
datawindow d
d = w.control[index]
d.X = d.X * rate
d.Width = d.Width * rate

case commandbutton!
commandbutton c
c = w.control[index]
c.X = c.X * rate
c.Width = c.Width * rate
case treeview!
treeview t
t = w.control[index]
t.X = t.X * rate
t.Width = t.Width * rate
case groupbox!
groupbox g
g = w.control[index]
g.X = g.X * rate
g.Width = g.Width * rate
case checkbox!
checkbox k
k = w.control[index]
k.X = k.X * rate
k.Width = k.Width * rate
case statictext!
statictext sa
sa = w.control[index]
sa.X = sa.X * rate
sa.Width = sa.Width * rate
case editmask!
editmask mask
mask = w.control[index]
mask.X = mask.X * rate
mask.Width = mask.Width * rate
case picture!
picture p
p = w.control[index]
p.X = p.X * rate
p.Width = p.Width * rate
case dropdownlistbox!
dropdownlistbox drop
drop = w.control[index]
drop.X = drop.X * rate
drop.Width = drop.Width * rate
case tab!
tab ta
ta = w.control[index]
//adjustwindow(ta.control[1])
a_num_controls = UpperBound(ta.control)
for a_index = 1 to a_num_controls
userobject u
u = ta.control[a_index]
adjustobject(u)
next
ta.X = ta.X * rate
ta.Width = ta.Width * rate
end choose
next
w.X = w.X * rate
if rate<>1.0 then
if w.Width<2600 or w.Width>2700 then
w.Width = w.Width * rate
end if
if w.Width>2540 then
w.Width = 2557
end if
end if
return


lqh178 2001-07-13
  • 打赏
  • 举报
回复
这个很麻烦,想做很久了,但一直没动手,谁愿意吃这个一劳永逸的螃蟹,我愿意持续给他分!

找出所有的控件,调整尺寸,调整字体,还有dw内的东西,很多很多,但是可以解决。
我在期待!

zzxx 2001-07-13
  • 打赏
  • 举报
回复
基本上这样很麻烦

604

社区成员

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

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