Article View: alt.pl.comp.lang.csharp
Article #10069Re: Formy i mdiContainer
From: Marcin Grzębski
Date: Wed, 16 Nov 2005 14:22
Date: Wed, 16 Nov 2005 14:22
34 lines
1608 bytes
1608 bytes
Witaj,
sg wrote:
> Mam pytanko, co trzeba zrobic aby w aplikacji mdi gdy klikam na button1
> i otwiera sie forma1 ponowne klikniecie na button1 nie otwieralo
> kolejnej formy1 tylko uaktynialo juz otwarta.
>
> Dzieki
>
> Seba
Polecam trzymać gdzieś referencję do otwartej formy, np.:
private Forma1 forma1=null;
if( forma1==null ) {
forma1=new Forma1();
// itd;
forma1.MdiParent=this;
forma1.Closed+=new EventHandler(forma1_Closed);
forma1.Show();
}
else {
forma1.Activate();
}
I zwalniać ją gdy nie jest "aktualna", np:
private void forma1_Closed(object sender, EventArgs e) {
forma1=null;
}
pozdrawiam
Marcin
Technical Details
Message-ID:
<dlffan$k1l$1@atlantis.news.tpi.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mailReferences:
<dlfa9r$7bv$1@news.onet.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.gazeta.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: Marcin Grzębski <mgrzebski@taxussi.no.com.spam.pl> Newsgroups: alt.pl.comp.lang.csharp Subject: Re: Formy i mdiContainer Date: Wed, 16 Nov 2005 15:22:04 +0100 Organization: tp.internet - http://www.tpi.pl/ Lines: 34 Message-ID: <dlffan$k1l$1@atlantis.news.tpi.pl> References: <dlfa9r$7bv$1@news.onet.pl> NNTP-Posting-Host: 199.wmok.net Mime-Version: 1.0 X-Trace: atlantis.news.tpi.pl 1132150935 20533 217.96.29.199 (16 Nov 2005 14:22:15 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Wed, 16 Nov 2005 14:22:15 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en In-Reply-To: <dlfa9r$7bv$1@news.onet.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit