常见问题:自动调整窗口内控间的大小[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 wxj_lake 的 blog

这是一个类模块:
1. 建立一个新的类模块,加入下列代码,并给类模块起名(例:autosize)
2. 加入一个窗口并且加入:private el as new autosize
3. 在 form_load 事件中加入 el.init me
4. 在 form_resize 事件中加入 el.formresize me


option explicit
private nformheight      as integer
private nformwidth       as integer
private nnumofcontrols   as integer
private ntop()           as integer
private nleft()          as integer
private nheight()        as integer
private nwidth()         as integer
private nfontsize()      as integer
private nrightmargin()   as integer
private bfirsttime       as boolean

sub init(frm as form, optional nwindstate as variant)
   dim i          as integer
   dim bwinmax    as boolean

   bwinmax = not ismissing(nwindstate)

   nformheight = frm.height
   nformwidth = frm.width
   nnumofcontrols = frm.controls.count - 1
   bfirsttime = true
   redim ntop(nnumofcontrols)
   redim nleft(nnumofcontrols)
   redim nheight(nnumofcontrols)
   redim nwidth(nnumofcontrols)
   redim nfontsize(nnumofcontrols)

   redim nrightmargin(nnumofcontrols)
   on error resume next
   for i = 0 to nnumofcontrols
      if typeof frm.controls(i) is line then
         ntop(i) = frm.controls(i).y1
         nleft(i) = frm.controls(i).x1
         nheight(i) = frm.controls(i).y2
         nwidth
			  
本文关键:常见问题:自动调整窗口内控间的大小
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top