Click here to Skip to main content
15,867,835 members
Articles / Programming Languages / C#

A C# LED matrix display

Rate me:
Please Sign up or sign in to vote.
4.91/5 (92 votes)
4 Apr 2010CPOL2 min read 194.9K   15.9K   211   50
A C# user control which displays texts or symbols as if they were displayed on an LED matrix screen.

Image 1

Description

This article introduces a C# user control which displays texts or symbols as if they were displayed on an LED matrix screen. The control manages several items, an item defined by its text, its direction, and its speed. The goal of the article is to describe the key points of the control; it's not a strictly technical explanation. There are no technical difficulties. The control is presented in an application that allows the user to manage two text items.

Key points

Mutli-display items

The control manages the display of an item list. Aan item is associated to an array which defines the LED "On" and position (X, Y) on the display. On a "PaintEvent", each LED on the display is analysed to know if there is an "LedOn" point among the items that corresponds to the LED.

Shema.JPG

Custom font file

To build the "LedOn" array of an item from a text string, the control introduces a conversion function which gives the LED On array via a symbol code as an input. The function uses an XML file as the translation file from the code to the symbol. Actually, the control introduces an example file in the resources of the project. The code used is the ASCII code. Each symbol in the file is defined by the LED "On" on its lines (the LED "On" is represented by a #).

XML
<LedMatrixSymbol SymbolCode="71" Description="G">
    <LedLine LineNumber="0" LineLedOn="_______"/>
    <LedLine LineNumber="1" LineLedOn="__###__"/>
    <LedLine LineNumber="2" LineLedOn="_#___#_"/>
    <LedLine LineNumber="3" LineLedOn="_#_____"/>
    <LedLine LineNumber="4" LineLedOn="_#_____"/>
    <LedLine LineNumber="5" LineLedOn="_#__##_"/>
    <LedLine LineNumber="6" LineLedOn="_#___#_"/>
    <LedLine LineNumber="7" LineLedOn="__###__"/>
</LedMatrixSymbol>

Modification on the flow

The properties of each item (LED "On" array, speed, and direction) can be changed at any time. The properties of the display (LED colours and matrix size) are also modifiable.

LED size management

In the first version of the code, the LED size was deducted by a simple way. Each LED cell was divided in six equals parts: 1 for the border on the left (top), 4 for the LED, and 1 for the border on the right (down). This way, the minimum size for an LED cell was 6 pixels.

PrevLedSz.JPG

In the new version, the LED cell is not divided in sections. The part of the LED diameter in the LED cell is not defined by code (2/3 in previous version) but by a coefficient as a new parameter of the control. So the ratio between the border and the LED can be set from 0 to 1.

NewLedSz.JPG

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer
France France
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionAdding a third line of text Pin
Member 1587509130-Dec-22 11:43
Member 1587509130-Dec-22 11:43 
QuestionChanging the Font to Arabic Pin
Member 1587509130-Dec-22 11:41
Member 1587509130-Dec-22 11:41 
PraiseNeat Project -- Thanks! Pin
Member 1556087515-Mar-22 20:46
Member 1556087515-Mar-22 20:46 
Questionhi Pin
Member 1537173026-Sep-21 16:09
Member 1537173026-Sep-21 16:09 
Questionwirelessly Pin
Member 1469648221-Dec-19 1:23
Member 1469648221-Dec-19 1:23 
Question16X16 with different colour Pin
Rakesh Raigar25-Apr-18 0:34
Rakesh Raigar25-Apr-18 0:34 
AnswerRe: 16X16 with different colour Pin
Member 1537173026-Sep-21 15:54
Member 1537173026-Sep-21 15:54 
I need little modification.In same project we can draw design by choose co lour brush selection like pen,rectangular,circle option & select thru co lour pallet which any size of matrix selection.
GeneralMy vote of 5 Pin
Karthik_Mahalingam10-Oct-17 17:57
professionalKarthik_Mahalingam10-Oct-17 17:57 
QuestionChanging color of words in rows Pin
Member 122556692-Jul-17 19:08
Member 122556692-Jul-17 19:08 
QuestionAbout How to support chinese characters? Pin
BlueStarLight9-Dec-15 15:02
BlueStarLight9-Dec-15 15:02 
QuestionAwesome, Pin
dayatz200822-Sep-15 0:24
dayatz200822-Sep-15 0:24 
QuestionLong time to set an item text Pin
Eduardo Fernandez del Peloso10-Dec-14 0:24
Eduardo Fernandez del Peloso10-Dec-14 0:24 
QuestionQuery abt LED Pin
Member 103755756-Nov-13 18:56
Member 103755756-Nov-13 18:56 
QuestionMatrice led Pin
Member 990650112-Mar-13 20:46
Member 990650112-Mar-13 20:46 
Questionits really very cool.. Pin
Laxman Kattikar11-Dec-12 0:43
Laxman Kattikar11-Dec-12 0:43 
GeneralMy vote of 5 Pin
Laxman Kattikar11-Dec-12 0:39
Laxman Kattikar11-Dec-12 0:39 
GeneralMy vote of 5 Pin
devvvy4-Dec-12 14:10
devvvy4-Dec-12 14:10 
QuestionHow to use it ? Pin
vincennes15-Apr-12 12:02
professionalvincennes15-Apr-12 12:02 
GeneralMy vote of 3 Pin
Julien Villers18-Dec-11 23:32
professionalJulien Villers18-Dec-11 23:32 
GeneralMy vote of 5 Pin
Addy Tas8-Dec-11 0:43
Addy Tas8-Dec-11 0:43 
GeneralMy vote of 3 Pin
Dave Kreskowiak5-Dec-11 6:14
mveDave Kreskowiak5-Dec-11 6:14 
QuestionFont to led implementation Pin
Nime Cloud25-Sep-11 21:44
Nime Cloud25-Sep-11 21:44 
GeneralBug in idle scrolling? Otherwise, Awesome! Pin
Stuart Rubin27-May-11 9:10
Stuart Rubin27-May-11 9:10 
GeneralMy vote of 5 Pin
craliaga20-May-11 9:44
craliaga20-May-11 9:44 
GeneralMy vote of 5 Pin
Xantilon17-Jan-11 23:05
professionalXantilon17-Jan-11 23:05 

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.