| 发表于:2008-01-15 10:24:18 楼主 |
我在做一個窗體内控件位置大小隨窗體大小而自動調整的工作。 以下是測試程序代碼: - vb.net code
private sub form1_resize(byval sender as object, byval e as system.eventargs) handles me.resize
datagridview1.location = new point(me.width * (12 / 387), me.height * (147 / 414))
datagridview1.size = new point(me.width * (363 / 387), me.height * (221 / 414))
button1.location = new point(me.width * (61 / 387), me.height * (36 / 414))
button1.size = new point(me.width * (75 / 387), me.height * (23 / 414))
button2.location = new point(me.width * (232 / 387), me.height * (36 / 414))
button2.size = new point(me.width * (75 / 387), me.height * (23 / 414))
button3.location = new point(me.width * (61 / 387), me.height * (92 / 414))
button3.size = new point(me.width * (75 / 387), me.height * (23 / 414))
button4.location = new point(me.width * (232 / 387), me.height * (92 / 414))
button4.size = new point(me.width * (75 / 387), me.height * (23 / 414))
end sub
測試通過沒有問題。 以下是實際應用程序裏面的代碼: - vb.net code
private sub frmday_resize(byval sender as object, byval e as system.eventargs) handles me.resize
me.rdb1.location = new point(me.width * (53 / 800), me.height * (11 / 600))
me.rdb1.size = new point(me.width * (85 / 800), me.height * (19 / 600))
me.lbl1.location = new point(me.width * (160 / 800), me.height * (36 / 600))
me.lbl1.size = new point(me.width * (82 / 800), me.height * (15 / 600))
end sub
提示:"new"不能在接口上使用。其中point下面有綠色波浪綫。 爲什麽測試程序沒有問題,到這裡來就有問題了?請高手指點一二。 |
|
|
|
|