# Custom cursor in VTK window

**URL:** https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853
**Category:** Support
**Created:** [February 16, 2022, 2:26pm UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853 "2022-02-16T14:26:41Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Sergio](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@Sergio](https://discourse.vtk.org/u/Sergio)
#### Post date: [February 16, 2022, 2:26pm UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853/1 "2022-02-16T14:26:41Z")

</div>

Hello,

I have a WPF application where one of its controls is hosting a VTK window. I want to set the icon of the mouse cursor to any image I want (for example, a magnifying glass to represent a zoom action). I have tried to do this from WPF side but when I hover the VTK window the cursor icon changes to VTK default cursor. I have also tried to set a custom icon from VTK side, but it appears that I can only choose among a small set of predefined cursors. Do you know how can I set a custom cursor for VTK?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![Sergio](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@Sergio](https://discourse.vtk.org/u/Sergio)
#### Post date: [March 9, 2022, 3:33pm UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853/2 "2022-03-09T15:33:51Z")

</div>

Any help for this?

---

<div class="post-metadata">

### Author: ![a772485252](https://discourse.vtk.org/user_avatar/discourse.vtk.org/a772485252/32/5327_2.png) [@a772485252](https://discourse.vtk.org/u/a772485252)
#### Post date: [August 19, 2022, 8:55am UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853/3 "2022-08-19T08:55:42Z")

</div>

Hello,Have you solved it？I have the same problem.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [August 22, 2022, 1:29pm UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853/4 "2022-08-22T13:29:53Z")

</div>

Custom cursors can be used via the `vtkRenderWindow`:

```cpp
renWin->SetCursorFileName(cur_file);
renWin->SetCurrentCursor(VTK_CURSOR_CUSTOM);

```

See [TestCustomCursorShape](https://gitlab.kitware.com/vtk/vtk/-/blob/03e04467edcf032fb015741deace8d16a6ffdebe/Rendering/OpenGL2/Testing/Cxx/TestCustomCursorShape.cxx) for an example.

---

<div class="post-metadata">

### Author: ![Sergio](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@Sergio](https://discourse.vtk.org/u/Sergio)
#### Post date: [September 27, 2022, 10:06am UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853/5 "2022-09-27T10:06:29Z")

</div>

Thank you very much for your answer! It works!

---

<div class="post-metadata">

### Author: ![learn\_forever](https://discourse.vtk.org/user_avatar/discourse.vtk.org/learn_forever/32/754_2.png) [@learn\_forever](https://discourse.vtk.org/u/learn_forever)
#### Post date: [February 4, 2024, 1:58am UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853/6 "2024-02-04T01:58:57Z")

</div>

Which VTK version begins to support this? I can’t find VTK\_CURSOR\_CUSTOM inside vtk8.1.2.  
Thanks.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [February 6, 2024, 4:13pm UTC](https://discourse.vtk.org/t/custom-cursor-in-vtk-window/7853/7 "2024-02-06T16:13:00Z")

</div>

Looking at the git history, it seems like it was added in v9.1.0.
