Click here to Skip to main content
11,570,750 members (57,856 online)
Click here to Skip to main content

A C# LED matrix display

, 4 Apr 2010 CPOL 83.7K 8.1K 192
Rate this:
Please Sign up or sign in to vote.
A C# user control which displays texts or symbols as if they were displayed on an LED matrix screen.

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 #).

<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)

Share

About the Author

Chootair
Engineer
France France
No Biography provided

You may also be interested in...

Comments and Discussions

 
QuestionLong time to set an item text Pin
Eduardo Fernandez del Peloso10-Dec-14 0:24
memberEduardo Fernandez del Peloso10-Dec-14 0:24 
QuestionQuery abt LED Pin
Member 103755756-Nov-13 18:56
memberMember 103755756-Nov-13 18:56 
QuestionMatrice led Pin
Member 990650112-Mar-13 20:46
memberMember 990650112-Mar-13 20:46 
Questionits really very cool.. Pin
laxmank811-Dec-12 0:43
memberlaxmank811-Dec-12 0:43 
But i want hexadecimal value of an led matrix line not of the row but i want the value of line in *.txt file... please help me..
GeneralMy vote of 5 Pin
laxmank811-Dec-12 0:39
memberlaxmank811-Dec-12 0:39 
GeneralMy vote of 5 Pin
devvvy4-Dec-12 14:10
memberdevvvy4-Dec-12 14:10 
QuestionHow to use it ? Pin
vincennes15-Apr-12 12:02
membervincennes15-Apr-12 12:02 
GeneralMy vote of 3 Pin
Julien Villers18-Dec-11 23:32
memberJulien Villers18-Dec-11 23:32 
GeneralMy vote of 5 Pin
Addy Tas8-Dec-11 0:43
memberAddy Tas8-Dec-11 0:43 
GeneralMy vote of 3 Pin
Dave Kreskowiak5-Dec-11 6:14
mvpDave Kreskowiak5-Dec-11 6:14 
QuestionFont to led implementation Pin
Nimea25-Sep-11 21:44
memberNimea25-Sep-11 21:44 
GeneralBug in idle scrolling? Otherwise, Awesome! Pin
Stuart Rubin27-May-11 9:10
memberStuart Rubin27-May-11 9:10 
GeneralMy vote of 5 Pin
craliaga20-May-11 9:44
membercraliaga20-May-11 9:44 
GeneralMy vote of 5 Pin
Xantilon17-Jan-11 23:05
memberXantilon17-Jan-11 23:05 
GeneralMy vote of 5 Pin
Srikanth039-Dec-10 1:01
memberSrikanth039-Dec-10 1:01 
GeneralA C# LED matrix display Pin
aleribrib6-Sep-10 7:03
memberaleribrib6-Sep-10 7:03 
GeneralA C# LED matrix display Pin
aleribrib3-Sep-10 4:46
memberaleribrib3-Sep-10 4:46 
GeneralRe: A C# LED matrix display Pin
Chootair6-Sep-10 1:22
memberChootair6-Sep-10 1:22 
QuestionHow to use UNICODE? Pin
jbahn22-Aug-10 15:08
memberjbahn22-Aug-10 15:08 
QuestionHow to support Chinese? Pin
432848316-May-10 17:04
member432848316-May-10 17:04 
AnswerRe: How to support Chinese? Pin
silas_yao18-Feb-11 4:35
membersilas_yao18-Feb-11 4:35 
GeneralGood Job Pin
lamasmg200212-May-10 21:38
memberlamasmg200212-May-10 21:38 
GeneralERROR Pin
lamasmg200212-May-10 21:37
memberlamasmg200212-May-10 21:37 
Generala simpler way Pin
Abdollah Zawari18-Apr-10 5:25
memberAbdollah Zawari18-Apr-10 5:25 
GeneralExcellent work Pin
radar_ksa17-Apr-10 23:34
memberradar_ksa17-Apr-10 23:34 
GeneralExtraordinary Pin
Pavan Nagumalli13-Apr-10 19:20
memberPavan Nagumalli13-Apr-10 19:20 
GeneralNow that is cool! Pin
Philip F.4-Apr-10 11:34
memberPhilip F.4-Apr-10 11:34 
QuestionMake the LED bigger? Pin
anga9-Mar-10 2:05
memberanga9-Mar-10 2:05 
AnswerRe: Make the LED bigger? Pin
Chootair4-Apr-10 8:39
memberChootair4-Apr-10 8:39 
Generalvery nice, but an error in symbol code 44 Pin
wima8-Mar-10 19:35
memberwima8-Mar-10 19:35 
GeneralRe: very nice, but an error in symbol code 44 Pin
Chootair4-Apr-10 8:41
memberChootair4-Apr-10 8:41 
Generalawesome Pin
Mico_Perez_II8-Mar-10 15:12
memberMico_Perez_II8-Mar-10 15:12 
GeneralNice Work!! Pin
ReymonARG3-Mar-10 6:09
memberReymonARG3-Mar-10 6:09 
GeneralGreat control! Pin
fmaeseele3-Mar-10 4:17
memberfmaeseele3-Mar-10 4:17 
GeneralFantastic!! Pin
Luca Bonotto3-Mar-10 1:28
memberLuca Bonotto3-Mar-10 1:28 
GeneralGreat work Pin
Khaniya2-Mar-10 23:54
memberKhaniya2-Mar-10 23:54 
GeneralExcellent Pin
Poiuy Terry2-Mar-10 22:39
memberPoiuy Terry2-Mar-10 22:39 
Generalvery funny! Pin
johannesnestler2-Mar-10 22:10
memberjohannesnestler2-Mar-10 22:10 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150624.2 | Last Updated 4 Apr 2010
Article Copyright 2010 by Chootair
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid