欢迎光临
我们一直在努力

vb.net 中MDI子窗体对其父窗体属性的获取与修改-.NET教程,VB.Net语言

建站超值云服务器,限时71元/月

兄弟前些日子做项目,第一次使用vb.net,碰上不少问题,相信很多初学者多多少少都会遇到这些问题,为了初学者学习方便,小弟总结了一些小经验,供大家参考讨论。

第一篇:如何在mdi子窗体中控制父窗体的属性等等

功能:比如打开一个子窗体后,就要设置父窗体中的某个菜单项或者按钮为不可见状态,诸如此类。

内容:

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 mdichildfomdefine 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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » vb.net 中MDI子窗体对其父窗体属性的获取与修改-.NET教程,VB.Net语言
分享到: 更多 (0)

相关推荐

  • 暂无文章