窗体控件大小随窗体大小变化而变化[5]

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

本文简介:选择自 athoncj 的 blog

                     controlrecord(maxcontrol).width = incontrol.width
              end if

       incontrol.integralheight = false
       on error goto 0
       addcontrol = maxcontrol
       maxcontrol = maxcontrol + 1
end function


function perwidth(pfrmin as form) as long

       dim i as long
       i = findform(pfrmin)

              if i < 0 then
                     i = addform(pfrmin)
              end if

       perwidth = (pfrmin.scalewidth * 100) \ formrecord(i).scalewidth
end function


function perheight(pfrmin as form) as double

       dim i as long
       i = findform(pfrmin)

              if i < 0 then
                     i = addform(pfrmin)
              end if

       perheight = (pfrmin.scaleheight * 100) \ formrecord(i).scaleheight
end function


public sub resizecontrol(incontrol as control, pfrmin as form)

       on error resume next
       dim i as long
       dim widthfactor as single, heightfactor as single
       dim minfactor as single
       dim yratio, xratio, ltop, lleft, lwidth, lheight as long
       yratio = perheight(pfrmin)
       xratio = perwidth(pfrmin)
       i = findcontrol(incontrol, pfrmin.name)

              if incontrol.left < 0 then
                     lleft = clng(((controlrecord(i).left * xratio) \ 100) - 75000)
              else
                     lleft = clng((controlrecord(i).left * xratio) \ 100)
              end if

       ltop = clng((controlrecord(i).top * yratio) \ 100)
       lwidth = clng((controlrecord(i).width * xratio) \ 100)
       lheight = clng((controlrecord(i).height * yratio) \ 100)
              if typeof incontrol is line then

                            if incontrol.x1 < 0 then
                                   incontrol.x1 = clng(((controlrecord(i).left * xratio) \ 100) - 75000)
                            else
                                   incontrol.x1 = clng((controlrecord(i).left * xratio) \ 100)

本文关键:窗体控件大小变化
  相关方案
Google
 

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

go top