2014-02-18 4 views
1

나는 youtube 내장형 플레이어 (axshockwaveflash)를 사용하여 멋진 프로그램을 만들고자합니다.키에 초점을 맞춘 양식

나는 현재 재생중인 비디오/다음/이전 버튼을 구현하려고합니다.

는 제가 기압이 것은 :

private void btReplay_Click(object sender, EventArgs e) 
    { 
     if (!youtubePlayer.Focus()) 
     { 
      youtubePlayer.Focus(); 
      SendKeys.Send("0"); 
     } 
     else 
     { 
      SendKeys.Send("0"); 
     } 
     this.BringToFront(); 
    } 

'0'키를 눌러 처음부터 비디오 재생을합니다. 그것만이 다른 열려있는 창 사이에서 양식을 사라지게합니다.

아시다시피 bringtofront를 사용해 보았지만 작동하지 않습니다.

의견이 있으십니까?

또한 누구나이 경험이있는 경우 'END'키를 사용할 때 다음 비디오 자동 재생을 사용하는 방법을 연주하고 싶습니다. Autoplay = 1 기능에 대해서는 알고 있지만 END 키를 누르면 작동하지 않는 것 같습니다.

편집 : 당신은 윈폼 또는 WPF 사용 여부 사용 윈폼은 BTW

답변

0
this.BringToFront(); 
this.TopMost = true; 

이 나를 위해 일을, 바보 난이 생각 didnt한다.

0

당신은 지정하지 않았습니다. 이 스 니펫은 winforms를위한 것입니다. 여기
내가 당신에게 앞으로 어떤 주어진 양식을 강제로 정적 메서드주고있다 :

public static void bringWindowToFront(System.Windows.Forms.Form form) 
    { 
     uint foreThread = GetWindowThreadProcessId(GetForegroundWindow(), System.IntPtr.Zero); 
     uint appThread = GetCurrentThreadId(); 
     const uint SW_SHOW = 5; 
     if (foreThread != appThread) 
     { 
      AttachThreadInput(foreThread, appThread, true); 
      BringWindowToTop(form.Handle); 
      ShowWindow(form.Handle, SW_SHOW); 
      AttachThreadInput(foreThread, appThread, false); 
     } 
     else 
     { 
      BringWindowToTop(form.Handle); 
      ShowWindow(form.Handle, SW_SHOW); 
     } 
     form.Activate(); 
    } 

    [System.Runtime.InteropServices.DllImport("user32.dll")] 
    private static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach); 

    [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)] 
    private static extern bool BringWindowToTop(System.IntPtr hWnd); 

    [System.Runtime.InteropServices.DllImport("kernel32.dll")] 
    public static extern uint GetCurrentThreadId(); 

    [System.Runtime.InteropServices.DllImport("user32.dll")] 
    private static extern System.IntPtr GetForegroundWindow(); 

    [System.Runtime.InteropServices.DllImport("user32.dll")] 
    private static extern uint GetWindowThreadProcessId(System.IntPtr hWnd, System.IntPtr ProcessId); 

    [System.Runtime.InteropServices.DllImport("user32.dll")] 
    private static extern bool ShowWindow(System.IntPtr hWnd, uint nCmdShow); 
+0

정면에 양식을 가져 오는 것이 훨씬 많습니다. 또한 미안 해요 WinForms – Bjorn9000

+0

을 사용하여 메신저를 말하는 첫 번째 게시물 editted "가장 강력한"winforms 솔루션의 가장 불리한 조건에서도 앞에 양식을 제공합니다. 트레이 아이콘 클릭으로 양식을 호출하는 데 사용합니다. 그렇지 않으면 양식이 현재 활성 응용 프로그램 뒤에 숨겨져있을 수 있습니다. – Traubenfuchs

관련 문제