中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > .NET > 临时文章
vb.net 中MDI子窗体对其父窗体属性的获取与修改
作者:未知 时间:2004-12-15 12:12 出处:Blog 责编:chinaitpower
              摘要:暂无

   兄弟前些日子做项目,第一次使用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 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

       

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有