0

neither

<WebBrowser x:Name="wbMain" Cursor="None"></WebBrowser>

nor

*{cursor:none}

is working for me. I can't find any resources online telling me how to accomplish this. The use-case for this is an application that runs full screen meant for viewing only after the setup takes place.

Edit: I forgot to add that the css works as expected when viewing the website in the IE9 browser.

aaaaaa
  • 1,233
  • 13
  • 24

3 Answers3

2

I don't know if this is a good or bad practice but you can add System.Windows.Forms reference

then

private void MouseEnter(object sender, MouseEventArgs e)
        {
            System.Windows.Forms.Cursor.Hide();
        }

        private void MouseLeave(object sender, MouseEventArgs e)
        {
            System.Windows.Forms.Cursor.Show();
        }

use this code on mouseEnter form example in web-browser control

Alaa Jabre
  • 1,843
  • 5
  • 26
  • 52
  • I believe there are no mouse event handlers with the web browser control -> http://stackoverflow.com/questions/2189510/wpf-webbrowser-mouse-events-not-working-as-expected – aaaaaa Sep 09 '12 at 19:59
  • _however_, the System.Windows.Forms.Cursor.Hide works like a charm. I still have to figure out a method to make it hide upon timer logic, but that should be simple. fyi - the supposedly correct way to hide the cursor in wpf applications is the following: Mouse.OverrideCursor = Cursors.None; Note that this doesn't work - for the reason I had wrongly assumed was the browser taking control of the cursor. – aaaaaa Sep 09 '12 at 20:09
  • any who glad you found what you want – Alaa Jabre Sep 09 '12 at 20:11
  • Yeah - I spent far too long on this. Thanks much for the tip. – aaaaaa Sep 09 '12 at 20:17
1

For those who dont like to add WinForms reference, try

[DllImport("user32.dll")]
static extern int ShowCursor(bool bShow);

and call ShowCursor(false) when needed.

Bla Bla
  • 11
  • 1
0

In app.cs

protected override void OnStartup(StartupEventArgs e)
{

    System.Windows.Forms.Cursor.Hide();

}
dustinos3
  • 934
  • 3
  • 17
  • 27