Jump to content
  • Advertisement
Sign in to follow this  
KanoT

How to hide mouse cursor in SlimDX render form?

This topic is 2609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys. I created simple mesh viewer using SlimDX for my research.

It has FPS-like camera control system. So I want to hide mouse cursor while controlling. How to hide or lock mouse cursor to center screen?

Share this post


Link to post
Share on other sites
Advertisement
The System.Window.Forms.Cursor has some static methods like Hide() and Show(). So you could probably do something like this:

renderForm.MouseEnter+= (s,e) => Cursor.Hide();

renderForm.MouseLeave+= (s,e) => Cursor.Show();


The Cursor also has a Position property which takes in coordinates in full screen space. The PointToScreen method of the RenderForm helps you converting points from client to screen space.

Cursor.Position = renderForm.PointToScreen(new Point(renderForm.ClientSize.Width / 2, renderForm.ClientSize.Height / 2));
You could set the position right after you have updated your camera.

Share this post


Link to post
Share on other sites

The System.Window.Forms.Cursor has some static methods like Hide() and Show(). So you could probably do something like this:

renderForm.MouseEnter+= (s,e) => Cursor.Hide();

renderForm.MouseLeave+= (s,e) => Cursor.Show();


The Cursor also has a Position property which takes in coordinates in full screen space. The PointToScreen method of the RenderForm helps you converting points from client to screen space.

Cursor.Position = renderForm.PointToScreen(new Point(renderForm.ClientSize.Width / 2, renderForm.ClientSize.Height / 2));
You could set the position right after you have updated your camera.


Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!