最后,將一個按鈕拖動到面板上。將它命名為 btnloadform,然后將它的 text 屬性設(shè)置為 load form。
此時,form1 應(yīng)如圖 1 所示。
圖 1:添加所有控件后處于設(shè)計模式下的 mdi 窗體
步驟 2:生成一個類,以存放可用窗體的數(shù)據(jù) 我們將獲取可能從基于 xml 的配置文件之外加載的窗體的有關(guān)信息。但是,為了更便于在組合框中顯示可用窗體并獲取有關(guān)所選窗體的信息,還應(yīng)建立一個對象集合。集合中的每個對象都將存放一個可用窗體的信息。對象應(yīng)具有以下屬性:
public class dynamicclass dim mslocation as string dim mstype as string dim msdescription as string
public sub new(byval slocation as string, _ byval sdescription as string, _ byval stype as string) me.location = slocation me.description = sdescription me.type = stype end sub
public property location() as string get return mslocation end get set(byval value as string) mslocation = value end set end property
public property type() as string get return mstype end get set(byval value as string) mstype = value end set end property
public property description() as string get return msdescription end get set(byval value as string) msdescription = value end set end property
public readonly property reference() as object get return me end get end property end class