专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > PB

关于pb自适应各种不同的分辨率的有关问题

发布时间:2011-06-29 20:30:22 文章来源:www.iduyao.cn 采编人员:星星草
关于pb自适应各种不同的分辨率的问题?
我用了

1。新建一个窗口。  
   
  为窗口写一个函数f_resize()大部分工作就在这里。  
  无输入参数  
  返回值为整形:  
   
  environment env  
  integer ii_ScreenWidth,ii_ScreenHeight  
  double WRadio,HRadio,Radio  
  integer ii_WinBolderWidth,ii_WinBolderHeight  
  getenvironment(env)  
  ii_WinBolderWidth=this.width - this.WorkSpaceWidth()//取得窗体的边框宽度  
  ii_WinBolderHeight=this.height - this.WorkSpaceHeight()  
  ii_ScreenWidth=env.screenwidth  
  ii_ScreenHeight=env.screenheight  
  //compute the radio that need be resize  
   
  WRadio=ii_ScreenWidth/800 //标准认为屏幕分辨率为800*600  
  HRadio=ii_ScreenHeight/600//计算出屏幕相对800*600分辨率的变化量  
  Radio=Min(WRadio,HRadio)  
  if Radio=1.0 then //if the screen is default 800*600  
  return 0  
  end if  
  this.hide()  
  this.width=(this.width - ii_WinBolderWidth)*Radio + ii_WinBolderWidth  
  this.height=(this.height - ii_WinBolderHeight)*Radio + ii_WinBolderHeight  
  integer i  
  dragobject temp//用于取各种控件  
   
  for i=1 to upperbound(this.control)  
  temp=this.control[i]//调整大小,位置  
  temp.width=temp.width*Radio  
  temp.x=temp.x*Radio  
  temp.y=temp.y*Radio  
  temp.Height=temp.Height*Radio  
  choose case typeof(temp)  
  case tab!  
  tab mtab  
  mtab=temp  
  mtab.textsize = mtab.textsize*Radio//设置字体  
  case commandbutton!  
  commandbutton cb  
  cb = temp  
  cb.textsize = cb.textsize*Radio  
   
  case singlelineedit!  
  singlelineedit sle  
  sle = temp  
  sle.textsize=sle.textsize*Radio  
  case editmask!  
  editmask em  
  em = temp  
  em.textsize = em.textsize*Radio  
   
  case statictext!  
  statictext st  
  st = temp  
  st.textsize = st.textsize*Radio  
   
  case datawindow! // datawindows get zoomed  
  datawindow dw  
  dw = temp  
  dw.Object.DataWindow.zoom = string(int(Radio*100))//注意DATAWINDOW与其它控件的不同  
   
  case picturebutton!  
  picturebutton pb  
  pb = temp  
  pb.textsize = pb.textsize*Radio  
   
  case checkbox!  
  checkbox cbx  
  cbx = temp  
  cbx.textsize = cbx.textsize*Radio  
   
  case dropdownlistbox!  
  dropdownlistbox ddlb  
  ddlb = temp  
  ddlb.textsize = ddlb.textsize*Radio  
   
  case groupbox!  
  groupbox gb  
  gb = temp  
  gb.textsize = gb.textsize*Radio  
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: