본문 바로가기
공부/개발노트

[C#] Form 생성 여부 확인 방법

반응형

if((IsFormAlreadyOpen(typeof(fWinHotFix)) == null))
{
fWinHotFix = new fWinHotFix();
fWinHotFix.Show();
}
else
{
fWinHotFix.WindowState = FormWindowState.Normal;
fWinHotFix.BringToFront();
fWinHotFix.Activate();
}
private Form IsFormAlreadyOpen(Type FormType)
{
foreach(Form OpenForm in Application.OpenForms)
{
if (OpenForm.GetType() == FormType)
return OpenForm;
}
return null;
}
반응형