国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

vb.net 中MDI子窗體對其父窗體屬性的獲取與修改

2024-07-10 13:01:06
字體:
供稿:網(wǎng)友
兄弟前些日子做項(xiàng)目,第一次使用vb.net,碰上不少問題,相信很多初學(xué)者多多少少都會遇到這些問題,為了初學(xué)者學(xué)習(xí)方便,小弟總結(jié)了一些小經(jīng)驗(yàn),供大家參考討論。
第一篇:如何在mdi子窗體中控制父窗體的屬性等等
功能:比如打開一個(gè)子窗體后,就要設(shè)置父窗體中的某個(gè)菜單項(xiàng)或者按鈕為不可見狀態(tài),諸如此類。
內(nèi)容:
mdi父窗體和mdi子窗體類定義如下:
mdi父窗體:
class mdiform
inherits system.windows.forms.form
.........
'member mnumain
friend withevents mnueditpaste as system.windows.forms.menuitem
.......
'member
friend withevents toolscan as system.windows.forms.toolbarbutton
private sub showchild()
dim frmtmp as new mdichildfom'define a new instantce of mdichildform
frmtmp.mdiparent = me 'set the new form to be a mdichild
frmtmp.show() 'show the new form
end sub
end class
mdi子窗體:
class mdichildform
.......
'set mnueditpaste & toolscan cannot be seen
private sub setmdimnutoolunvisible()
'***************************************'
' first method you can set a menuitem to be unvisible'
'***************************************'
'this method you could not control one menuitem
'you can only set a group of menuitems
me.mdiparent.menu.menuitems(0).visible = false 'set the first group menuitem can not be seen
'with this method you have not right to modify toolscan

dim frmmdi as mdiform
if tyhpeof me.mdiparent is mdiform
frmmdi = directcast(me.mdiparent, mdiform)'get the instantce of me.mdiparent
'then you should access all the members of class mdiform without private members
frmmdi.mnueditpaste = false
frmmdi.toolscan = flase
'like this you could do everything with mdiform you want
end if

end sub
end class

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 樟树市| 双流县| 朔州市| 龙泉市| 巨野县| 江华| 蒙自县| 桐乡市| 通城县| 长治县| 濮阳市| 门头沟区| 霍邱县| 平舆县| 乐昌市| 龙山县| 阿克| 呈贡县| 濉溪县| 泰安市| 海城市| 蓬溪县| 承德县| 亚东县| 武定县| 图们市| 阿坝县| 宜君县| 刚察县| 阿拉善左旗| 永福县| 左贡县| 遂溪县| 准格尔旗| 中牟县| 邢台市| 青阳县| 洪雅县| 洞头县| 本溪| 阿克苏市|