首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

数据窗口中的图片控件如何自适应图片大小

2012-12-29 
数据窗口中的图片控件怎么自适应图片大小如题 我不知道是要写程序控制 还是对这个控件的属性进行设置 我用

数据窗口中的图片控件怎么自适应图片大小
如题 我不知道是要写程序控制 还是对这个控件的属性进行设置 我用的是pb11.5版本的 望各位大侠帮忙 谢谢
[解决办法]
使用数据窗口的modify方法
[解决办法]
这个估计得写代码。。。

[解决办法]
试了一下 这个应该满足你要求 存成w_1 导入到你PBL里 看下效果

$PBExportHeader$w_1.srw
forward
global type w_1 from window
end type
type p_2 from picture within w_1
end type
type st_1 from statictext within w_1
end type
type cb_2 from commandbutton within w_1
end type
type cb_1 from commandbutton within w_1
end type
type p_1 from picture within w_1
end type
type gb_1 from groupbox within w_1
end type
end forward

global type w_1 from window
integer width = 2533
integer height = 1408
boolean titlebar = true
string title = "Untitled"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
p_2 p_2
st_1 st_1
cb_2 cb_2
cb_1 cb_1
p_1 p_1
gb_1 gb_1
end type
global w_1 w_1

on w_1.create
this.p_2=create p_2
this.st_1=create st_1
this.cb_2=create cb_2
this.cb_1=create cb_1
this.p_1=create p_1
this.gb_1=create gb_1
this.Control[]={this.p_2,&
this.st_1,&
this.cb_2,&
this.cb_1,&
this.p_1,&
this.gb_1}
end on

on w_1.destroy
destroy(this.p_2)
destroy(this.st_1)
destroy(this.cb_2)
destroy(this.cb_1)
destroy(this.p_1)
destroy(this.gb_1)
end on

type p_2 from picture within w_1
boolean visible = false
integer x = 1367
integer y = 68
integer width = 165
integer height = 144
boolean originalsize = true
boolean focusrectangle = false
end type

type st_1 from statictext within w_1
integer x = 1486
integer y = 104
integer width = 457
integer height = 72
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
string text = "1152X1256"
boolean focusrectangle = false
end type

type cb_2 from commandbutton within w_1
integer x = 1810
integer y = 840
integer width = 457
integer height = 128
integer taborder = 10
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!


fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "exit"
end type

event clicked;close(parent)
end event

type cb_1 from commandbutton within w_1
integer x = 1810
integer y = 584
integer width = 457
integer height = 128
integer taborder = 10
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "LOAD"
end type

event clicked;long ll_px,ll_py,ll_pw,ll_ph
long ll_gx,ll_gy,ll_gw,ll_gh
ll_gx = 27
ll_gy = 20
ll_gw = 1152
ll_gh = 1256 - 60
string ls_docpath, ls_docname,ls_file
integer i, li_cnt, li_rtn, li_filenum
 li_rtn = GetFileOpenName("选择文件", &
    ls_docpath, ls_docname, "*.*", &
     + "All Files (*.*), *.*", &
    "C:", 18)
IF li_rtn < 1 THEN return 
ls_file = string(ls_docpath)

long ll_width,ll_height
dec{3} ld_rate,ld_rate1
p_2.picturename = ls_file
ll_width = p_2.width
ll_height = p_2.height
if ll_width < ll_gw - 6 and ll_height < ll_gh - 6 then
 ld_rate = 1
else
 if ll_width < ll_gw - 6 and ll_height > ll_gh - 6 then 
  ld_rate  = ll_height / (ll_gh - 6)
 else
  if ll_width > ll_gw - 6 and ll_height < ll_gh - 6 then
   ld_rate  = ll_width / (ll_gw - 6)
  else
   if ll_width > ll_gw - 6 and ll_height > ll_gh - 6 then
    ld_rate  = ll_height / (ll_gh - 6)
    ld_rate1  = ll_width / (ll_gw - 6)
    ld_rate = max(ld_rate,ld_rate1)
   end if
  end if
 end if
end if
ll_pw = ll_width / ld_rate
ll_ph = ll_height  / ld_rate
p_1.width = ll_pw
p_1.height = ll_ph
p_1.x = ll_gx + long((ll_gw - ll_pw - 6) / 2)
p_1.y = ll_gy + long((ll_gh - ll_ph - 6) / 2) + 60
p_1.picturename = ls_file

//FileClose( ll_job )
end event

type p_1 from picture within w_1
integer x = 82
integer y = 196
integer width = 1010
integer height = 896
boolean focusrectangle = false
end type

type gb_1 from groupbox within w_1
integer x = 27
integer y = 20
integer width = 1152
integer height = 1256
integer taborder = 10
integer textsize = -12


integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 67108864
end type

热点排行