[Gtk-sharp-list] How to hide the mouse cursor in GTK#?

Michael Hutchinson m.j.hutchinson at gmail.com
Mon Oct 5 12:38:49 EDT 2009


On Mon, Oct 5, 2009 at 10:44 AM, aethix <j.rupp at xyz.de> wrote:
>
> Hallo,
>
> I want to hide the mouse cursor in my GTK# project.
> With Windows Forms I can do this with
>    Cursor.Hide();
>
> Is there any simular methode or anything else in GTK#?

I believe  the conventional way is to create a 1x1 transparent cursor
and use that:

using (Pixmap inv = new Pixmap (null, 1, 1, 1)) {
 	invisibleCursor = new Cursor (inv, inv, Gdk.Color.Zero, Gdk.Color.Zero, 0, 0);
}

For an example, see
http://anonsvn.mono-project.com/viewvc/trunk/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs?view=markup

Don't forget to dispose the cursor when you're done.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Gtk-sharp-list mailing list