| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1166 人关注过本帖
标题:怎么解决数据窗口对象与起关联数据窗口一起自动缩放
只看楼主 加入收藏
guihao
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-6-3
收藏
 问题点数:0 回复次数:4 
怎么解决数据窗口对象与起关联数据窗口一起自动缩放

我是继承自动缩放窗口,自动缩放窗口函数如下:请问怎么修改?
函数uf_resize:

DragObject dragcontrol
line line_contr
Oval oval_contr
Rectangle rect_contr
RoundRectangle roun_contr
tab l_tab
userobject luo_control


choose case v_winobj.typeof()
case commandbutton!,picturebutton!,checkbox!,radiobutton!, &
statictext!,staticHyperLink!,picture!, &
pictureHyperLink!,groupbox!,singlelineedit!,editmask!, &
multilineedit!,richtextedit!,hscrollbar!,Vscrollbar!, &
Htrackbar!,VtrackBar!,HprogressBar!,VprogressBar!, &
dropdownlistbox!,dropdownpicturelistbox!,listbox!, &
picturelistbox!,listview!,treeview!,datawindow!, &
graph!,olecontrol!
dragcontrol=v_winobj
dragcontrol.move(s_consize.s_conx[v_lj]*ll_width,s_consize.s_cony[v_lj]*ll_height)
dragcontrol.resize(s_consize.s_conw[v_lj]*ll_width,s_consize.s_conh[v_lj]*ll_height)
v_lj=v_lj+1

case Line!
line_contr=v_winobj
line_contr.beginx=s_consize.s_conx[v_lj]*ll_width
line_contr.beginy=s_consize.s_cony[v_lj]*ll_height
line_contr.endx=s_consize.s_conw[v_lj]*ll_width
line_contr.endy=s_consize.s_conh[v_lj]*ll_height
v_lj=v_lj+1
case Oval!
oval_contr=v_winobj
oval_contr.x=s_consize.s_conx[v_lj]*ll_width
oval_contr.y=s_consize.s_cony[v_lj]*ll_height
oval_contr.width=s_consize.s_conw[v_lj]*ll_width
oval_contr.height=s_consize.s_conh[v_lj]*ll_height
v_lj=v_lj+1
case Rectangle!
rect_contr=v_winobj
rect_contr.x=s_consize.s_conx[v_lj]*ll_width
rect_contr.y=s_consize.s_cony[v_lj]*ll_height
rect_contr.width=s_consize.s_conw[v_lj]*ll_width
rect_contr.height=s_consize.s_conh[v_lj]*ll_height
v_lj=v_lj+1
case RoundRectangle!
roun_contr=v_winobj
roun_contr.x=s_consize.s_conx[v_lj]*ll_width
roun_contr.y=s_consize.s_cony[v_lj]*ll_height
roun_contr.width=s_consize.s_conw[v_lj]*ll_width
roun_contr.height=s_consize.s_conh[v_lj]*ll_height
v_lj=v_lj+1
case tab!
l_tab=v_winobj
l_tab.x=s_consize.s_conx[v_lj]*ll_width
l_tab.y=s_consize.s_cony[v_lj]*ll_height
l_tab.width=s_consize.s_conw[v_lj]*ll_width
l_tab.height=s_consize.s_conh[v_lj]*ll_height
v_lj=v_lj+1

integer li_ti1,li_ti2
for li_ti1=1 to upperbound(l_tab.control[])
for li_ti2=1 to upperbound(l_tab.control[li_ti1].control[])
uf_resize(l_tab.control[li_ti1].control[li_ti2],ll_width,ll_height)
next
next

case userobject!
luo_control=v_winobj
luo_control.x=s_consize.s_conx[v_lj]*ll_width
luo_control.y=s_consize.s_cony[v_lj]*ll_height
luo_control.width=s_consize.s_conw[v_lj]*ll_width
luo_control.height=s_consize.s_conh[v_lj]*ll_height
v_lj=v_lj+1

integer li_uconnum,li_ui
li_uconnum=upperbound(luo_control.control[])
for li_ui=1 to li_uconnum
uf_resize(luo_control.control[li_ui],ll_width,ll_height)
next

end choose


return 0


函数uf_position:


DragObject dragcontrol
Line line_contr
Oval oval_contr
Rectangle rect_contr
RoundRectangle roun_contr
Tab l_tab
Userobject luo_control


Choose Case v_winobj.typeof()
Case commandbutton!,picturebutton!,checkbox!,radiobutton!, &
statictext!,staticHyperLink!,picture!, &
pictureHyperLink!,groupbox!,singlelineedit!,editmask!, &
multilineedit!,richtextedit!,hscrollbar!,Vscrollbar!, &
Htrackbar!,VtrackBar!,HprogressBar!,VprogressBar!, &
dropdownlistbox!,dropdownpicturelistbox!,listbox!, &
picturelistbox!,listview!,treeview!,datawindow!, &
graph!,olecontrol!

dragcontrol=v_winobj
s_consize.s_conx[v_li]=dragcontrol.x/ll_width
s_consize.s_cony[v_li]=dragcontrol.y/ll_height
s_consize.s_conw[v_li]=dragcontrol.width/ll_width
s_consize.s_conh[v_li]=dragcontrol.height/ll_height
v_li=v_li+1
Case Line!
line_contr=v_winobj
s_consize.s_conx[v_li]=line_contr.beginx/ll_width
s_consize.s_cony[v_li]=line_contr.beginy/ll_height
s_consize.s_conw[v_li]=line_contr.endx/ll_width
s_consize.s_conh[v_li]=line_contr.endy/ll_height
v_li=v_li+1
Case Oval!
oval_contr=v_winobj
s_consize.s_conx[v_li]=oval_contr.x/ll_width
s_consize.s_cony[v_li]=oval_contr.y/ll_height
s_consize.s_conw[v_li]=oval_contr.width/ll_width
s_consize.s_conh[v_li]=oval_contr.height/ll_height
v_li=v_li+1
Case Rectangle!
rect_contr=v_winobj
s_consize.s_conx[v_li]=rect_contr.x/ll_width
s_consize.s_cony[v_li]=rect_contr.y/ll_height
s_consize.s_conw[v_li]=rect_contr.width/ll_width
s_consize.s_conh[v_li]=rect_contr.height/ll_height
v_li=v_li+1
Case RoundRectangle!
roun_contr=v_winobj
s_consize.s_conx[v_li]=roun_contr.x/ll_width
s_consize.s_cony[v_li]=roun_contr.y/ll_height
s_consize.s_conw[v_li]=roun_contr.width/ll_width
s_consize.s_conh[v_li]=roun_contr.height/ll_height
v_li=v_li+1
Case tab!
l_tab=v_winobj
s_consize.s_conx[v_li]=l_tab.x/ll_width
s_consize.s_cony[v_li]=l_tab.y/ll_height
s_consize.s_conw[v_li]=l_tab.width/ll_width
s_consize.s_conh[v_li]=l_tab.height/ll_height
v_li=v_li+1

integer li_ti1,li_ti2
for li_ti1=1 to upperbound(l_tab.control[])
for li_ti2=1 to upperbound(l_tab.control[li_ti1].control[])
uf_position(l_tab.control[li_ti1].control[li_ti2],ll_width,ll_height)
next
next

Case userobject!
luo_control=v_winobj
s_consize.s_conx[v_li]=luo_control.x/ll_width
s_consize.s_cony[v_li]=luo_control.y/ll_height
s_consize.s_conw[v_li]=luo_control.width/ll_width
s_consize.s_conh[v_li]=luo_control.height/ll_height
v_li=v_li+1

integer li_uconnum,li_ui
li_uconnum=upperbound(luo_control.control[])
for li_ui=1 to li_uconnum
uf_position(luo_control.control[li_ui],ll_width,ll_height)
next
End Choose

Return 0


[此贴子已经被作者于2006-6-21 12:42:38编辑过]

搜索更多相关主题的帖子: 缩放 窗口 数据 对象 contr 
2006-06-20 23:44
niute
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2006-6-2
收藏
得分:0 
晕,我也不会!!正想学这招呢!
这些函数都放在窗口的哪个位置吓阿??
2006-06-21 20:44
ykserver
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-4-20
收藏
得分:0 

这样写代码是不是太浪费时间了,应该用最简单的方法来实现。在父窗就把同步写好。

2006-06-29 08:24
fgypblt
Rank: 1
等 级:新手上路
帖 子:67
专家分:0
注 册:2006-6-27
收藏
得分:0 

一般测试软件中datawindow自适应窗体大小可暂时使用如下代码,正式使用有现成的界面类(编程时窗口多为继承关系)代码的:
设 rw/rh 为resize后的window窗体与原窗体宽、高之比,dw代表datawindow控件
integer dwsc
//调节位置 其他控件也可如此
dw.resize(dw.width *rw,dw.height * rh)
dw.x=dw.x*rw
dw.y=dw.y*rh
/*调节大小 ddlb cb em等控件为ddlb.textsize属性
dwsc=integer(dw.Object.DataWindow.Zoom)
dwsc=round(rh*dwsc,0)//integer(rh*100)
dw.Object.DataWindow.Zoom =string(dwsc)


2006-06-29 10:09
niute
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2006-6-2
收藏
得分:0 
这些代码放到窗口的open 事件中?
2006-06-29 22:32
快速回复:怎么解决数据窗口对象与起关联数据窗口一起自动缩放
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020570 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved