首页 新闻 搜索 专区 学院

如何点击按钮只示例一个窗体

0
悬赏园豆:10 [已关闭问题] 关闭于 2008-06-30 21:11
很搞的写了一个类似如下的代码<br><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">class</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;Singleton :Form<br>&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">private</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">static</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;Singleton&nbsp;instance; <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">private</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;Singleton()&nbsp;{&nbsp;} <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">public</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">static</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;Singleton&nbsp;Instance <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">get</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman"> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">if</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;(instance&nbsp;</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">==</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">null</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">) <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;instance&nbsp;</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">=</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">new</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;Singleton(); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></span><span style="color: rgb(0, 0, 255);"><font size="3" color="#000000" face="Times New Roman">return</font></span><span style="color: rgb(0, 0, 0);"><font size="3" color="#000000" face="Times New Roman">&nbsp;instance; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br>&nbsp;&nbsp;&nbsp;&nbsp;} </font></span><br>点按钮数次 只启动一个 很好 <br>但只要关闭窗体再启动出现 无法访问以释放对象 <br>错在哪里? 咋整?
pandaren的主页 pandaren | 菜鸟二级 | 园豆:201
提问于:2008-06-30 20:39
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册