开发者

How can I hide the cursor in transparent WPF window?

How can I hide the cursor in a WPF window that is fully transparent (alpha=0).

I tried the usual

this.Cursor = System.Windows.Input.Cursors.None;

and it works on areas wit开发者_StackOverflow社区h content where alpha > 0 but when the cursor moves to an area - in the same window - where the background is fully transparent the cursor re-appears.

I also added System.Windows.Input.Mouse.OverrideCursor = System.Windows.Input.Cursors.None; but that didn't help.

I realize that setting the alpha of background to 1 might be a solution but for various reasons this creates other problems...


Maybe as a work-around you can create a tiny non-transparent area somewhere, and move the mouse there just before hiding it:

// Coordinates of your non-transparent area:
var x = 10;
var y = 10;
System.Windows.Forms.Cursor.Position = new System.Drawing.Point(x, y);
this.Cursor = System.Windows.Input.Cursors.None;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜