Windows 7 및 Windows Vista에서 클릭 한 알림 아이콘 바로 위에 양식을 배치 할 수있는 방법이 있습니까?클릭 한 알림 아이콘 위의 위치 양식
답변
귀하의 의견에 관하여 : "어떻게하면 작업 표시 줄의 위치를 알 수 있습니까?"
Rectangle trayRectangle = WinAPI.GetTrayRectangle();
: 당신이 그렇게 같은 용지함의
Rectangle Structure를 검색 할 수 있습니다,이 클래스를 사용
[c#] NotifyIcon - Detect MouseOut
: 트레이에 대한 Rectangle Structure를 검색하는 방법을 노출하는 클래스를 포함하는 다음 문서 밖으로
확인
너비와 높이와 함께 트레이의 위쪽, 왼쪽, 오른쪽 및 아래쪽 좌표를 제공합니다.
I 클래스 아래에 포함했다 :이 도움이
using System;
using System.Runtime.InteropServices;
using System.Drawing;
using System.ComponentModel;
public class WinAPI
{
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
public override string ToString()
{
return "(" + left + ", " + top + ") --> (" + right + ", " + bottom + ")";
}
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr FindWindow(string strClassName, string strWindowName);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, IntPtr windowTitle);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
public static IntPtr GetTrayHandle()
{
IntPtr taskBarHandle = WinAPI.FindWindow("Shell_TrayWnd", null);
if (!taskBarHandle.Equals(IntPtr.Zero))
{
return WinAPI.FindWindowEx(taskBarHandle, IntPtr.Zero, "TrayNotifyWnd", IntPtr.Zero);
}
return IntPtr.Zero;
}
public static Rectangle GetTrayRectangle()
{
WinAPI.RECT rect;
WinAPI.GetWindowRect(WinAPI.GetTrayHandle(), out rect);
return new Rectangle(new Point(rect.left, rect.top), new Size((rect.right - rect.left) + 1, (rect.bottom - rect.top) + 1));
}
}
희망.
그로테스크 해킹입니다. 왜 마우스 오른쪽 버튼 클릭 이벤트에서 커서 위치를 읽는 대신에 그렇게할까요? 왜 제대로 할 수있을 때 해킹에 의지할까요? –
@David Heffernan 작업 표시 줄의 위치를 파악하는 올바른 방법은 무엇입니까? 나는 그것이 왼쪽/오른쪽/위/아래에 있는지 알아야합니다. – blejzz
@blejzz 한스는 이미 아이콘을 찾을 수 없다고 설명했습니다. 할 수있는 일은 아이콘 컨텍스트 메뉴를 호출 한 이벤트의 커서 위치를 얻는 것입니다. 그걸로 당신은 어떤 구석 밖으로 운동 할 수 있습니다. –
쉬운 방법이 있습니다.
OnClick 이벤트가 발생하면 마우스의 X, Y 위치를 가져올 수 있습니다. 또한 이러한 개체 (예 : Screen.PrimaryScreen.Bounds
, Screen.PrimaryScreen.WorkingArea
)를 사용하여 작업 표시 줄 위치를 확인할 수도 있습니다.
private void OnTrayClick(object sender, EventArgs e)
{
_frmMain.Left = Cursor.Position.X;
_frmMain.Top = Screen.PrimaryScreen.WorkingArea.Bottom -_frmMain.Height;
_frmMain.Show();
}
- 1. 설정의 알림 알림 아이콘
- 2. 알림 아이콘
- 3. 위치 : 위의 상대 위치 : 절대
- 4. 한 번 클릭으로 대체 아이콘 위치
- 5. GTK + 시작 알림 아이콘
- 6. senseUI 용 알림 아이콘
- 7. iPhone 알림 아이콘
- 8. C# 알림 양식
- 9. Xcode 아이콘 위치
- 10. UITabBar 표준 아이콘 위치
- 11. QTabBar 아이콘 위치
- 12. 위치 정보 공개 아이콘
- 13. Android 개발 알림 아이콘 문제
- 14. 코드 안의 Android 알림 아이콘
- 15. .NET의 불투명 한 클릭 연결 양식
- 16. 현재 위치 알림 액세스
- 17. 알림 창 위치
- 18. GPS 위치 변경 알림
- 19. 위치 서비스 변경 알림?
- 20. 한 번 클릭 업데이트 사용자가 만든 바탕 화면 아이콘 삭제
- 21. 이미지의 마우스 클릭 위치
- 22. 위치 서비스 iOS 알림 콜백
- 23. XNA 창의 양식 아이콘 설정?
- 24. 알림 영역 아이콘 목록을 얻는 방법은 무엇입니까?
- 25. android 플랫폼 1.5 - 3.2에 대한 알림 아이콘
- 26. C# 텍스트 알림 해제 (트레이 아이콘)
- 27. 텍스트가 포함 된 알림 아이콘 오버레이
- 28. 마우스 클릭 위치에서 위치 결정
- 29. 수동 양식 위치 지정
- 30. 클릭 보안 업데이트 위치 확보
이 정보가 도움이됩니까? http://codetechnic.blogspot.com/2009/03/set-windows-forms-start-position-to.html – Zenwalker
아니요는 작업 표시 줄의 오른쪽 하단 모서리에 양식을 배치합니다. 알림 아이콘 위에 위치시켜야합니다. – blejzz
가능한 중복 : http://stackoverflow.com/questions/272778/how-to-find-the-location-of-the-icon-in-the-system-tray –