PB控件如何随窗口大小变化

PB控件怎么随窗口大小变化?
下面这段代码是我在网上找的,原贴地址:http://bbs.51cto.com/thread-133790-1.html

我拷了之后老是有个语法错误,好像是在case 语句那段,我看不出来是怎么回事,高手能帮我看看吗?谢谢

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 
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 
  case dropdownlistbox! 
   dropdownlistbox ddlb 
   ddlb = temp 
   ddlb.textsize =  ddlb.textsize*Radio 
  case groupbox! 
   groupbox gb 
   gb = temp 
   gb.textsize =  gb.textsize*Radio 
  case listbox! 
   listbox lb 
   lb = temp 
   lb.textsize  =  lb.textsize*Radio 
  case multilineedit! 
   multilineedit mle 
   mle = temp 
   mle.textsize = mle.textsize*Radio
  case radiobutton! 
   radiobutton rb 
   rb = temp 
   rb.textsize =  rb.textsize*Radio 
end choose 
next 
this.show() 
return 0 


------解决方案--------------------
试一下:

choose case temp.typeof() //typeof(temp)
......
------解决方案--------------------
case tab!

没有tab!这个属性.
------解决方案--------------------
你应该把语法错误贴出来你应该把语法错误贴出来
------解决方案--------------------
http://topic.csdn.net/u/20090328/09/cb6067c5-0592-47fe-be29-43e13d74c3c8.html
------解决方案--------------------
找到原因了,是你COPY代码把一些空格什么的特殊字符拷进来了,
应该如下:
C# code
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
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 temp.TypeOf()
        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
        Case dropdownlistbox!
            dropdownlistbox ddlb
            ddlb = temp
            ddlb.TextSize =ddlb.TextSize*radio
        Case groupbox!
            groupbox gb
            gb = temp
            gb.TextSize =gb.TextSize*radio
        Case listbox!
            listbox lb
            lb = temp
            lb.TextSize=lb.TextSize*radio
        Case multilineedit!
            multilineedit mle
            mle = temp
            mle.TextSize = mle.TextSize*radio
        Case radiobutton!
            radiobutton rb
            rb = temp
            rb.TextSize =rb.TextSize*radio
    End Choose
Next
This.Show()
Return 0