WPF: drawing own cursor - nontrivial problem

主宰稳场 提交于 2019-12-04 18:11:55

thanks to http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a3cb7db6-5014-430f-a5c2-c9746b077d4f

i can click through my self-drawn cursor which follows the mouse-position by setting the window style:none, and allowtransparent as i already did and then

public const int WS_EX_TRANSPARENT = 0x00000020;
  public const int GWL_EXSTYLE = (-20);

  [DllImport("user32.dll")]
  public static extern int GetWindowLong(IntPtr hwnd,
  int index);

  [DllImport("user32.dll")]
  public static extern int SetWindowLong(IntPtr hwnd,
  int index, int newStyle);

  public static void makeTransparent(IntPtr hwnd) {
     int extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
     SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_TRANSPARENT);
  }

and call makeTransparent from OnSourceInitialized...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!