Home · Register · Login · Contact

Using the GMSI.NET Alphanumeric LED

Title: Using the GMSI.NET Alphanumeric LED control to build an LED clock
Estimated Time: 5 minutes
Video: Getting Started with GMSI.Net Controls (with embedded player - Filesize: 6.3 MB)

Special Note: This tutorial is aimed at showing a software developer how easy it is to configure a Global Majic Software .NET component and how much flexibility these components provide. Remember, these are software components, NOT complete applications.


  1. Place a Numeric LED GMSI.NET Control on a form. Resize the Numeric LED to suit your needs.

  2. numled_step1_wopt.jpg


  3. If the Numeric LED properties browser is not already open, simply right click on the control and select Properties.
    1. Click on the Numeric LED property browser and under Appearance change the DisplayMode to alpha / numeric. Adjust the Spacing and SegmentWidth properties to the desired size. As you can see, all changes are real timeimmediately visible on the control.

    2. numled_step2a_wopt.jpg
    3. Change the BackColor, OnColor and OffColor properties to the desired colors. For all color choices, you can choose from the System color set, the Web color set, and the Custom color set by clicking the tabs at the top of the drop-down color menu.


  4. Right click on the Numeric LED and select View Code.

  5. numled_step2b.jpg


  6. Type DateTime _time = new DateTime(0); below the text private GMS.Instruments.NumericLed.NumericLed numericLed1. This creates an object named _time that is an instance of the type DateTime.

  7. Now create a Time property for the Numeric LED. Place the following text above the Windows Form Designer generated code.

  8. numled_step5_wopt.jpg




    public DateTime Time
    {
       get
       {
          return _time;
       }

       set
       {
          _time = value;

          int hour = _time.Hour;

          if (_time.Hour > 12)
          hour -= 12;

          numericLed1.Text = string.Format("{0,2:D1}:{1,2:D2}:{2,2:D2}", hour, _time.Minute, _time.Second);
       }
    }

  9. The string.Format() method obtains the appropriate string representation of the current hour, minute, and second and sets it to the Numeric LEDs Text.


  10. Click on the [Design] tab at the top of the screen. Click on the Visual Studio ToolBox and select Windows Forms. Double-Click the Timer timer.jpg button to add it to the Windows Form.

  11. numled_step7_wopt.jpg


  12. Click on the Timer property browser and change the Enabled property to true and the Interval property to 1000 (seconds).


  13. Now click the Events events.jpg Tab in the property browser, and double-click Tick. This will automatically generate the code for the Timer s tick event named timer1_Tick.


  14. Type Time = System.DateTime.Now; between the brackets of the timer1_Tick event. This gets the current time from the computer.


  15. Under the Build menu, select Build Solution to build the project. Then choose Start under the Debug menu to run it. The Numeric LED clock is now complete and will display the current time.

  16. numled_step9.jpg