Thursday, September 05, 2013

Raspberry pi mono hide cursor

It seems to be quite a common problem getting the cursor to hide in an application running on x-windows. The mono implementation of c# winforms doesn't currently support Cursor.Hide() functionality at all.

I began by using unclutter which monitors the x-display and hides the cursor very quickly after any movement, but it is still visible, and if the CPU is busy it can be visible for some time.

However, an article from microsoft helped me solve it. I downloaded a blank cursor file from some random website, and added the blank.cur to my project as an embedded resource. This code which I placed in my form_load method then replaces the normal cursor with the blank one:
            this.Cursor = new Cursor(GetType(), "blank.cur");  

Easy, and very effective for my fullscreen touchscreen mono app running on my 7" eGalax touchscreen from the raspberry pi.

No comments: