国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 宁陵县| 澄城县| 衡阳市| 东兰县| 闽侯县| 安泽县| 三台县| 安国市| 新蔡县| 陵川县| 安达市| 龙岩市| 秭归县| 水富县| 洱源县| 拉孜县| 大足县| 肇东市| 宜昌市| 陆河县| 岳西县| 庆城县| 大连市| 天水市| 志丹县| 内乡县| 衡阳市| 开鲁县| 安达市| 两当县| 罗江县| 杭锦旗| 贵阳市| 长寿区| 长汀县| 苍山县| 郓城县| 嘉禾县| 广平县| 澄城县| 宜州市|