由于某种原因数据窗口的列用户有可能不让显示这样,如何动态修改Grid中加入的文本标题宽度,让标题文字一直在中间

时间:2020-12-05 23:21:20
由于某种原因数据窗口的列用户有可能不让显示这样,如何动态修改Grid中加入的文本标题宽度,让标题文字一直在中间

 

就是不会取宽度呀!!! 我是这样想的。请高手指点一下????

//动态屏蔽网线
dw_1.modify("create rectangle(band=foreground x='9' y='8' height='564' width='2875'  name=r_1 visible='1' brush.hatch='6' brush.color='134217737' pen.style='0' pen.width='5' pen.color='16777215'  background.mode='2' background.color='16777215' )rectangle(band=foreground x='0' y='8' height='564' width='2875'  name=r_1 visible='1' brush.hatch='6' brush.color='134217737' pen.style='0' pen.width='5' pen.color='16777215'  background.mode='2' background.color='16777215' )")
//动态增加主标题                                                                                                                                                                                                                                                                           //高,//宽       
dw_1.modify("create text(band=foreground alignment='2' text='医保中心医院端职工消费明细' border='0' color='0' x='0' y='172'                                                                                                                                                              height='144' width='2875' html.valueishtml='0'  name=t_1 visible='1'  font.face='Arial' font.height='-20' font.weight='400'  font.family='2' font.pitch='2' font.charset='0' background.mode='2' background.color='33554431' )")
//动态增加附标题                                                                                                                                                                                                                                                                           //高,//宽       


 

5 个解决方案

#1


<DW Control Name>.Describe("<Textname>.Width")

#2


你的modify语句有问题,内部的create在生成对象时,虽有指定对象名称,但名称重复,应分配不同的对象名

#3


想办法取到最后一列的位置和宽度,使 文本标题宽度 = 最后一列.x + 最后一列.width

#4


//一个取数据窗口宽度的函数

string str_objects,str_object,str_x2
int int_maxy,int_pos


str_objects=adw_data.Describe("DataWindow.Objects")+'~t'
int_pos=pos(str_objects,"~t")
do while int_pos>0
str_object=left(str_objects,int_pos - 1)
str_objects=mid(str_objects,int_pos + 1)
int_pos=pos(str_objects,"~t")

if adw_data.describe(str_object+".band")='detail' and (adw_data.describe(str_object+".type")='column' or adw_data.describe(str_object+".type")='compute') then
    str_x2=string(integer(adw_data.describe(str_object+".x"))+integer(adw_data.describe(str_object+".width")))
int_maxy=max(int_maxy,integer(str_x2))
end if
loop

return int_maxy

#5


mark

#1


<DW Control Name>.Describe("<Textname>.Width")

#2


你的modify语句有问题,内部的create在生成对象时,虽有指定对象名称,但名称重复,应分配不同的对象名

#3


想办法取到最后一列的位置和宽度,使 文本标题宽度 = 最后一列.x + 最后一列.width

#4


//一个取数据窗口宽度的函数

string str_objects,str_object,str_x2
int int_maxy,int_pos


str_objects=adw_data.Describe("DataWindow.Objects")+'~t'
int_pos=pos(str_objects,"~t")
do while int_pos>0
str_object=left(str_objects,int_pos - 1)
str_objects=mid(str_objects,int_pos + 1)
int_pos=pos(str_objects,"~t")

if adw_data.describe(str_object+".band")='detail' and (adw_data.describe(str_object+".type")='column' or adw_data.describe(str_object+".type")='compute') then
    str_x2=string(integer(adw_data.describe(str_object+".x"))+integer(adw_data.describe(str_object+".width")))
int_maxy=max(int_maxy,integer(str_x2))
end if
loop

return int_maxy

#5


mark