Click here to Skip to main content
15,881,802 members
Articles / Desktop Programming / Windows Forms
Article

GLUI-style Spinner

Rate me:
Please Sign up or sign in to vote.
2.20/5 (3 votes)
20 Jun 20052 min read 38K   442   11   2
Creating an OpenGL GLUI-style spinner.

Sample Image - spinner.jpg

Introduction

Having had loads of fun working with OpenGL, I decided to try my hand at DirectX. I thought what better way to start than to take my OpenGL projects and see how they work in DirectX. I ran into a barrier when the original project used various GLUI objects which are not available in .NET. This is my first GLUI-style control.

Using the code

As this is a beginner control, there is not much difference between this and a Microsoft control. The control is derived from a System.Windows.Forms.Panel as I needed something to contain the System.Windows.Forms.TextBox and two System.Windows.Forms.Button objects. This has allowed me to keep the usability of a single control (i.e., you cannot tab to each button, instead to each spinner as a while).

Each Spinner has the following properties for setting the behavior to the user's liking:

  • The 'Minimum' and 'Maximum' properties to set the range of the Spinner.
  • A 'Value' property to set the original value of the Spinner.
  • A 'Theta' property to set the step value for the Spinner.

Using this control should be as simple as using any other Panel; just drop it on a form and set the listed properties to your desire.

Points of Interest

This is not exactly a final release. I am still relatively new to .NET development, so there are a few features I plan to add just as soon as I learn how. As it stands, you can change the Spinner value in three ways:

  1. Input the value by using the numeric keypad found on your keyboard.
  2. Use the buttons on the right side of the control.
  3. Use the Up and Down arrow keys on your keyboard while the control has focus.

Currently, there is no code in place to stop the user from inputting a value outside the range, but the next click of the button or press of the arrow keys will set the value to the range minimum or maximum, whichever applies.

History

As this is the first draft, there aren't any updates.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I graduated from Michigan Technological University in 2002 with a bachelor's in Computer Science. I am currently working as a .NET developer.

Comments and Discussions

 
GeneralOut-of-range values Pin
fwsouthern20-Jun-05 16:13
fwsouthern20-Jun-05 16:13 
GeneralRe: Out-of-range values Pin
bowlermonk21-Jun-05 2:37
bowlermonk21-Jun-05 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.