沒有Anchor屬性,也沒有Bindevent函數,因此需要使用類定義中的_Parent.Resize來實現錨定:
Define Class BackImage As Image
Stretch = 2
Procedure Parent.Resize
This.Move(0 ,0 ,This.Parent.Width ,This.Parent.Height)
EndProc
EndDefine
然後使用下列代碼添加到_Screen中:
_Screen.AddObject('BackImage' ,'BackImage')
With _Screen.BackImage
.Picture = m.cPicture
.Move(0 ,0 ,_Screen.Width ,_Screen.Height)
.Visible = .T.
EndWith
VFP7.0及以後版本中
在_Screen中添加壹個Image控件作為背景,設置Stretch屬性為變比填充,並調整它的大小與位置使它填滿整個屏幕,然後設置錨定值為15。代碼如下:
If !PemStatus(_Screen ,'BackImage' ,5) Then
_Screen.AddObject('BackImage' ,'Image')
EndIf
With _Screen.BackImage
.Stretch = 2
.Picture = m.cPicture
.Move(0 ,0 ,_Screen.Width ,_Screen.Height)
.Anchor = 15
.Visible = .T.
EndWith