Click here to Skip to main content
15,881,248 members
Articles / Desktop Programming / WPF

Seven Segment in WPF

Rate me:
Please Sign up or sign in to vote.
3.85/5 (10 votes)
24 Jan 2012CPOL 45.4K   4.1K   34   13
WPF Seven Segment User Control

WPF Seven Segment

Introduction

In some of graphical softwares we need to have something like a SevenSegment, I need it somedays ago. So I've created this UserControl.

Background

I saw some seven segment user controls in different websites.
e.g:
Seven-segment LED Control for .NET
http://www.teroid.net/product.aspx?name=wpfsevensegmentdisplay
but no one of them could resolve my need.

Using the code

If you like to use this usercontrol in your application , you have to follow the following instructions :

1. First, you have to add the usercontrol Dll into your Application References :

References

2. Next, Add the following property into the Window tag :

Add the property into the Window tag

3. At Last, You can use the UserControl with the following XAML code :

You can use the UserControl with this code

Public Properties of SevenSegment UserControl

C#
/// <summary>
/// Color Of Seven Segment Number
/// </summary>
public SolidColorBrush NumberColor
{
    ...
}

/// <summary>
/// Color Of dot `.` char
/// </summary>
public SolidColorBrush ColonColor
{
    ...
}

/// <summary>
/// Is `.` Visible or not
/// </summary>
public Visibility DotVisibility
{
    ...
}

/// <summary>
/// Is `:` Visible or not
/// </summary>
public Visibility ColonVisibility
{
    ...
}

/// <summary>
/// Delay of number blinking animation
/// </summary>
public KeyTime KeyTime { get; set; }

/// <summary>
/// Delay of `.` char blinking animation
/// </summary>
public KeyTime ColonKeyTime { get; set; }

/// <summary>
/// Peresents colon characters `:` with animation
/// </summary>
public bool ColonAnimation
{
    ...
}

/// <summary>
/// Radius of Blur on SevenSegment 
/// </summary>
public int BlurRadius
{
    ...
}

/// <summary>
/// Peresents SevenSegment with animation
/// </summary>
public bool PlayAnimation
{
    ...
}

Public Method of SevenSegment UserControl

C#
/// <summary>
/// Sets number of seven segment number
/// </summary>
public void SetNumber(int number) { ... }

History

First Post : 2012/01/26

License

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


Written By
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionWell done! Pin
Steffen Ploetz30-Sep-15 1:16
mvaSteffen Ploetz30-Sep-15 1:16 
QuestionImproper "two dots" synchronization Pin
Philippe Mori3-Nov-14 17:10
Philippe Mori3-Nov-14 17:10 
GeneralMy vote of 2 Pin
ridoy21-Sep-13 6:56
professionalridoy21-Sep-13 6:56 
QuestionGood but how to scale Pin
Jason Song1-Jun-12 4:27
Jason Song1-Jun-12 4:27 
AnswerRe: Good but how to scale Pin
Mohammad Dayyan3-Jun-12 21:35
Mohammad Dayyan3-Jun-12 21:35 
QuestionExcellent Pin
jcarter12121225-May-12 15:03
jcarter12121225-May-12 15:03 
GeneralMy vote of 2 Pin
DavidMyEmail25-Jan-12 4:55
DavidMyEmail25-Jan-12 4:55 
QuestionNeeds more depth Pin
BillW3325-Jan-12 2:26
professionalBillW3325-Jan-12 2:26 
GeneralKeep up the creative work Pin
TonyVictorious25-Jan-12 1:39
TonyVictorious25-Jan-12 1:39 
GeneralRe: Keep up the creative work Pin
Mohammad Dayyan25-Jan-12 1:42
Mohammad Dayyan25-Jan-12 1:42 
QuestionThis is not really an article Pin
Sacha Barber24-Jan-12 19:59
Sacha Barber24-Jan-12 19:59 
QuestionGood but of no use. Pin
aamironline24-Jan-12 19:13
aamironline24-Jan-12 19:13 
AnswerRe: Good but of no use. Pin
Andy Missico24-Jan-12 20:09
Andy Missico24-Jan-12 20:09 
No use to you. I find it useful.

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.