我有两个自己写的全局函数,可是....愿意奉上,但有要求,帮我研究研究,可不要得了东东,忘了本,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