posted by 방랑군 2012. 1. 13. 19:55

참조 :   http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=18&MAEULNo=8&no=1774&ref=1774 

1. WinAPI를 사용한다.

2. ShowWithoutActivation 프로퍼티를 상속받아서 Child Form Class를 구현한다.

 

 

그럼 차례대로 소개하도록 하겠습니다. 그리 어렵지 않습니다.

 

 

 

1. WinAPI - ShowWindow함수 사용

 

[System.Runtime.InteropServices.DllImport("user32.dll")]

public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

 

//RecvMemoWnd가 Form입니다. (쪽지창)

RecvMemoWnd memo = new RecvMemoWnd (strTitle, strContent, strTime, strSender);

ShowWindow(memo .Handle, WM_SHOWNOACTIVATE); //WM_SHOWNOACTIVATE = 4

 

 

 

2. 닷넷 - ShowWithoutActivation를 오버라이드하는 Child Form Class

 

public class Test : Form

{

   bool showWithoutActivation = false;

   protected override bool ShowWithoutActivation

   {

      get

      {

         return showWithoutActivation;

      }
   }

 

   public void Show(bool activate)

   {

      showWithoutActivation = !activate;

      Show();
   }
}

 

--------------------------------------------------------------------

 

Test test = new Test();

test.Show(false);