Important alert: (current site time 7/16/2013 2:38:46 AM EDT)
 

winzip icon

MorphDisplay v1.11 - LED / LCD Digital Display Control

Email
Submitted on: 4/29/2007 5:33:13 PM
By: Option Explicit 
Level: Intermediate
User Rating: By 47 Users
Compatibility: VB 6.0
Views: 34465
author picture
(About the author)
 
     (29 Apr 2007 - Minor tweaks; removed MatrixDisplay control for later repost) An ownerdrawn digital display usercontrol that uses shaped regions to form hexagonal, trapezoidal or rectangular LED/LCD digit segments. Control can be used for calculator displays, displaying time, or as a simple counter. Just about every conceivable aspect of this control can be customized via a multitude of properties. Main and exponent digits are separately configurable. Properties for segment height and width, intersegment gap, and interdigit gap allow you to size, position and space digits exactly the way you want. Support for thousands and decimal separators. Thousands and decimal separators can be defined as a comma or period so that international standards can be maintained. Thousands grouping can also be adjusted according to international preference. Background can be gradient or bitmap. Background bitmap can be tiled or stretched. All colors are also fully user-definable. Negative numbers can be displayed in a different color than positive. Digit segments can have a 3D gradient added to them if desired. Corners can be individually rounded for a different look. A simulated digit burn-in display mode is also available if desired. A Filament option allows digits to be displayed as wireframed, rather than solid. Exponent display can be disabled if you wish to use this as a simple counter. Six basic themes are included that show various display styles. Since there's ~40 properties that make up one theme, it is a very good idea to make a theme out of a combination of properties that works well in a particular application. Inspired by LaVolpe's "Shaped Regions" project at txtCodeId=58562. As always, constructive feedback is welcome, and votes are always appreciated.

 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :MorphDisplay v1.11 - LED / LCD Digital Display Control
'**************************************
Many.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 8 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
2/3/2006 3:28:03 AMRichard Mewett

This is far and away the best digital display I've seen implemented in VB. Great control over appearance and style and its renders very cleanly. It's rare to see something like this that does not use an array of controls. *****
(If this comment was disrespectful, please report it.)

 
2/3/2006 6:38:00 AMmichael doering

Hi,
this is the best Display I have seen yet.
Thanks to share this excellent control.
Keep up this good work.
(If this comment was disrespectful, please report it.)

 
2/3/2006 7:10:23 AMOption Explicit

Thanks, Richard and Michael. I am currently working on adding a 'dot-matrix' style for an alternative to the segments. I'm adapting Steven Atkiss' innovative approach at txtCodeId=64108, and that will be posted as soon as I can cleanly integrate it.
(If this comment was disrespectful, please report it.)

 
2/3/2006 9:10:20 AMLaVolpe

Matt, 95% of what I post I can't use in real life (at my job). It's a nice compliment to see some of my ideas incorporated into other's work. Thanx.
(If this comment was disrespectful, please report it.)

 
2/3/2006 11:06:43 AMHeriberto Mantilla Santamaria

wow, my first UC in VB was a Display but seeing yours mine gives laugh.

LaVolpe for a Electronic Engineer that needs a sw to show data in a board this code for him is perfect.

Excellent work Matt.
(If this comment was disrespectful, please report it.)

 
2/3/2006 11:46:05 AMHerbert N Swearengen III

This control looks excellent! And I've never seen a control of this type with so many features. Excellent work!

Unfortunately, I have left the world of VB6 programming and am now doing all my work in Visual Basic 2005. But I can still use your control by compiling it to a dll and using com interop. Or, because your code is so clean, I maybe be able to convert it to VB 2005. There are just some "as any"'s in the API functions and one 1-based array.

Anyway, thanks so much.
(If this comment was disrespectful, please report it.)

 
2/3/2006 12:57:20 PMOption Explicit

LaVolpe, it's I who should be thanking you... you give a lot to this site and I've learned more VB from coders like you than I ever could from a college course in VB.
(If this comment was disrespectful, please report it.)

 
2/3/2006 12:59:51 PMOption Explicit

Thanks for the nice words Heriberto and Herbert. Just remember that this is the first day of this being posted and actually being used by people... there are bound to be bugs so be patient. I'm also aware this can be a somewhat balky control to use due to all the properties. Over time this will morph (hey!) into a better control. Stay tuned and thanks again.
(If this comment was disrespectful, please report it.)

 
2/3/2006 5:19:02 PMjeremyxtz

Instead of creating Polygon regions you could have used the Polygon api.
(If this comment was disrespectful, please report it.)

 
2/3/2006 6:07:35 PMOption Explicit

Hi Jeremy. I'm the first to admit I don't know everything API. I just looked at allapi.net and it seems to me that with shaped regions you form them once and then just refer to them when you need them. With polygon you are creating them every time you wish to display a polygon. However, I honestly don't know. I do know that the example that inspired this submission was written using the shaped regions, so that's what I used. Six of one, a half dozen of the other? Don't know. I have a lot to learn yet... thanks for the feedback.
(If this comment was disrespectful, please report it.)

 
2/3/2006 6:40:13 PMjeremyxtz

With Polygon - you use an array of points to draw the Polygon - if you store the points you can draw it again... when creating a Polygon region you use the same set of points but create a region with it then draw on the region. No odds to the end result -I thought I'd mention it in case you were using Regions because you didn't know about the Polygon function.

Not a criticism - its an excellent submission.
(If this comment was disrespectful, please report it.)

 
2/3/2006 6:57:51 PMOption Explicit

Jeremy, one thing occurs to me. The Polygon API uses POINTAPI structures for the X,Y of the vertices. That tells me it displays the polygon at a certain location on the HDC, which means you'd have to have cached info for every possible segment location in an LED-type screen. In a 20 digit display that works out to 140 segments to store info for. With shaped regions there is no location info attached. I can take only two segments (horizontal and vertical) and position them anywhere. So maybe there is a difference. I appreciate anybody who makes me figure something out, so thanks for that (and the vote).
(If this comment was disrespectful, please report it.)

 
2/4/2006 9:40:41 AMLaVolpe

Polygon is very useful & much faster than creating regions. However, if you need a region for other purposes: clipping is a prime example, or applying to a window to shape it, then obviously a region is needed. Regions do give you some additional flexibility because they are objects & you can use a host of APIs designed for objects/regions (copying, moving, filling, etc, etc). Of course the bottom line is: are you just drawing a shape or do you want to manage/apply the shape.
(If this comment was disrespectful, please report it.)

 
2/5/2006 12:36:27 PMOption Explicit

Hi everybody, thanks for the comments and votes; both are very much appreciated... I like the fact I'm "seeing some new faces" in the voting and comment areas... maybe because this is a different type of control. In any case thanks again!
(If this comment was disrespectful, please report it.)

 
2/5/2006 12:50:06 PMRuturaj

This is really a nice control. Please consider Alpha-Numeric data display as an extension to this project. I'm currently working on a Project which interacts with COM port and display some electronic board data on Interface. I need to display units of those values (like 2.45 V for volts or 1.23 A for current and so on ...). This display I don't think allows me to have alphabets in it, does it? Please consider it as an extension to this control and hope you will share that control with us as well. You said this is perfect for showing clock, then how about allowing programmers to show AM/PM in the same digital display itself? Believe me, placing a Label ahead of this control makes the overall stuff look really bad! This is really a nice control even at this point; but be better with Alpha-Numeric display support. If you implement it then please let me know ... mailme_friends@yahoo.com

Thanks & Regards,

Ruturaj.
(If this comment was disrespectful, please report it.)

 
2/5/2006 4:10:38 PMOption Explicit

Hi Ruturaj. Thanks very much for the nice feedback. I am currently working on a control to go with it that will be able to display alphanumerics. It's matrix-oriented and not the segmented LED-style look that MorphDisplay provides but it may serve your needs. I'll add this as a separate control to this project and update it to PSC when it's ready (a week or two depending on free time). I'll email you with a preliminary screenshot. Thanks again - Matt

(If this comment was disrespectful, please report it.)

 
2/6/2006 8:33:11 AMRichard Mewett

Good to see this is getting the votes it deserves. Bring on the Matrix.... :D
(If this comment was disrespectful, please report it.)

 
2/6/2006 1:27:50 PMOption Explicit

The matrix itsa comin'... the matrix itsa comin'... :-)
(If this comment was disrespectful, please report it.)

 
2/6/2006 4:45:53 PMSteven Atkiss

I may be late but I'm here, Congratulations (Again) on a totally Unique and inspiering control, Not only Inspiering in what it does, but also inspiering the fact there are no other controls involved. Excellant work.
(If this comment was disrespectful, please report it.)

 
2/6/2006 6:21:58 PMOption Explicit

Thanks for the support Steven. However, at least for now, the MatrixDisplay control I am working on and will be adding to this project uses your label/picbox character mapping scheme. I am working to eliminate the constituent controls [according to intergalactic law, a control must not contain any other controls in order to be deemed a MorphControl :-)] but for now that works great! The matrix itsa comin'... Thanks again.
(If this comment was disrespectful, please report it.)

 
2/11/2006 1:43:33 PMJim Jose

Well done !!! Very very fines works here.... you got my 5 stars *****
(If this comment was disrespectful, please report it.)

 
2/11/2006 10:03:45 PMOption Explicit

Thank you Jim... Check back in a couple of days and I'll have a beta version of an additional control added into this project for more senseless fun :-)
Good luck with your new McDriveFolderFileListBox! :)
(If this comment was disrespectful, please report it.)

 
2/12/2006 1:21:35 PMOption Explicit

OK, I have added the beta version of an alphanumeric matrix-style calculator display to this project. It has properties that are different than MorphDisplay, so in order to avoid unnecessarily cluttering up MorphDisplay I've made it a separate control. Two for the price of one! :-) Thanks to Steven Atkiss for inspiring this with his creative submission at txtCodeId=64108.
(If this comment was disrespectful, please report it.)

 
2/12/2006 10:10:09 PMRuturaj

This update is really nice and now it allows me to have "," and "-" in values! This will serve my purpose. Thanks a lot for this timely update.

(If this comment was disrespectful, please report it.)

 
2/13/2006 5:13:29 AMRichard Mewett

Cool update - where do I put my other ***** ? :)
(If this comment was disrespectful, please report it.)

 
2/13/2006 7:17:17 AMOption Explicit

Richard, you should know better than to ask a cranky sarcastic person like me where to stick your vote ;)

Ruturaj I'm glad this will help you with the project you mentioned. I'll be improving this matrix display if people indicate they want this or that but I'm glad the beta works for you.
(If this comment was disrespectful, please report it.)

 
2/14/2006 7:59:03 AMHeriberto Mantilla Santamaria

Yeah Richard, Matt take my five virtual globes xD.
(If this comment was disrespectful, please report it.)

 
2/16/2006 6:42:53 AMEvilgenious

Hi Metheww Usnar. Good to see you have done a great job again. Good Luck.
(If this comment was disrespectful, please report it.)

 
2/16/2006 2:02:07 PMOption Explicit

Hi EvilG, haven't seen you around in a while. Thanks for the compliment and vote!
(If this comment was disrespectful, please report it.)

 
2/18/2006 6:13:17 AMRichard Mewett

IMO this should have have broken the 30 barrier (for 5 globes) by now - its a sorry state that more PSC users don't bother to leave feedback or show appreciation with a vote. Good luck with COTM :)
(If this comment was disrespectful, please report it.)

 
2/18/2006 10:28:19 AMOption Explicit

Hi Richard, thanks for the nice words. Howver, I believe people vote partially on whether or not the code is actually useful to them - "Is this something I will use in my own projects?" This is one of those controls that are of use in certain situations but are probably not a "must have" in everyone's toolbox. I *do* believe that if someone requests an alteration, new feature, etc. and the submitter makes the effort to make that certain someone happy, they should vote as a matter of courtesy. But as we all know, voting is voluntary. I appreciate the great support I have received so far for what is basically just a tricked-out label control. Thanks again.
(If this comment was disrespectful, please report it.)

 
3/9/2006 5:41:04 AMChad Gutowsky

Bling, Bling..... Outta this world. Clean, PERFECT! Thanks for sharing. 6 Globes. ^O^
(If this comment was disrespectful, please report it.)

 
3/9/2006 5:52:09 PMOption Explicit

Thanks Chad. And a big thanks to everybody who left feedback and voted to make this control my third contest win.
(If this comment was disrespectful, please report it.)

 
3/12/2006 9:15:29 PMOption Explicit

Stay tuned... sometime in the coming week a new version will be posted that incorporates the blit-to-region stuff I experimented with in MorphBorder. 3D gradient segmented LED displays! And you won't even need 3D glasses! This was a big pain to put in but the results are worth it imho. Also working on a very obnoxious screenshot to go with it :D
(If this comment was disrespectful, please report it.)

 
3/13/2006 9:04:46 AMHappy Lobster

Thanks for sharing your amazing user controls, you've spent a lot of time and effort coding. Great coding! Another 5*. Will have to try and sneak it in to some apps at work! :)
(If this comment was disrespectful, please report it.)

 
3/13/2006 1:02:56 PMOption Explicit

Thanks Mr. Lobster! No guarantee of perfection in any of my stuff but yeah I put some hours into these things. Hope you (and others) find my stuff entertaining and useful.
(If this comment was disrespectful, please report it.)

 
3/14/2006 9:30:00 AMJuan Carlos San Román

Excellent job. Thanks to share this nice project. 5 from me
(If this comment was disrespectful, please report it.)

 
3/14/2006 3:29:48 PMOption Explicit

Thanks Juan! Appreciate it. The gradient segment update is why I did MorphBorder - I needed a simple way to learn bitblt-ing to a region apart from more complex projects like this. Once I got that worked out, the method went into this.
(If this comment was disrespectful, please report it.)

 
3/15/2006 1:16:28 AMDavor

This man is realy amazing, he knows his job and he responds to everyone. I haven't seen something like this ever. Will you work for me (Croatia) ;-). 5 stars, Thnx
(If this comment was disrespectful, please report it.)

 
3/15/2006 5:58:07 PMOption Explicit

Davor, I would work for you but it's too long of a drive every morning to get from the U.S. to Croatia ;) Thanks for the nice words and the vote.
(If this comment was disrespectful, please report it.)

 
4/7/2006 8:25:25 AMayman metwally

As always, Very beatiful ..
Thanks Matt foe sharing this hard and useful work.
Your friend,
Ayman Metwally
(If this comment was disrespectful, please report it.)

 
4/7/2006 8:32:27 AMayman metwally

Ops, I forgot to vote!
My vote is: Excellent.
(If this comment was disrespectful, please report it.)

 
4/7/2006 3:39:24 PMOption Explicit

Hi Ayman! Thanks! Haven't talked to you in a while. Hopefully you got past that API problem you were having.
(If this comment was disrespectful, please report it.)

 
4/12/2006 12:07:57 AMayman metwally

Hi Matt,
It's nice talking to you again.
And regarding the API problem, Well the solution is simply don't let the problem to occur at the first place!
if Object.left < 0 then Object.left = 0
if Object.Top < 0 then Object.Top = 0

I found nothing else to solve the problem.
Thanks for asking.
Ayman

(If this comment was disrespectful, please report it.)

 
4/27/2006 1:00:01 AMRob C

Hi,
5 Globes.
Could i echo Ruturaj's request to be able to display Time with AM or PM

Thanks for sharing
(If this comment was disrespectful, please report it.)

 
4/27/2006 7:12:57 AMOption Explicit

Hi Rob. Thanks for the feedback and vote. The beta of "MatrixDisplay" included in this submission was intended to answer Ruturaj's request (and he seemed happy with it), but after I get past some issues in my latest project I will look into altering MorphDisplay to accommodate AM/PM. Thanks again.
(If this comment was disrespectful, please report it.)

 
5/16/2006 12:00:09 AMkbhrx

thanks 4 superb code
(If this comment was disrespectful, please report it.)

 
5/16/2006 9:10:21 PMOption Explicit

Thank you kbhrx, I wouldn't exactly call it superb coding but it was a very interesting project. Appreciate the comment.
(If this comment was disrespectful, please report it.)

 
5/16/2006 9:13:58 PMOption Explicit

Rob C asked for the ability to display AM or PM next to the time, so update is posted (partially, anyway). The A and P are easy in a 7-segment display. The M doesn't work in 7 segments. So hopefully A and P are sufficient! Most physical LED/LCD clock displays just use the A and P anyway (probably for the very same reason). See MorphLCD2 in Form4 for usage details.
(If this comment was disrespectful, please report it.)

 
6/28/2006 10:49:56 AMal boz

Wow, pupa, excellent! Thanks, keep up the good work, do a LCD panel for ebooks.
(If this comment was disrespectful, please report it.)

 
1/7/2007 6:03:16 AMHajo

Very, very great Work ! The best LCD Display ever seen in VB. Thank you for this excellent control !
(If this comment was disrespectful, please report it.)

 
1/8/2007 10:33:53 PMyunus emre özkara

Thank you,
Supers Code
I'm From Turkey :) I dont not speak English
(If this comment was disrespectful, please report it.)

 
2/3/2007 1:20:57 PMTacho57

Excellent look!!!, if it works like it feels ( I say this before testing, but the comments are so good ... ), It`s better than a real LCD ( I`m an Electronic Engineer Designer that use many of them ), keep making excellent job and thanks to share with the beginners like me, thank to PSC too, I`m new in this site
My vote is 5 or more..., yes before running ;).
You said "VB is for fun" in my case is a nice tool to test my designs, my problem is that I dont have enough time to study more and make real code like yours, Thanks for saving our time and life too :)
I`m from Argentina and sorry about my poor english, this is my first comment in this site.
(If this comment was disrespectful, please report it.)

 
3/10/2007 6:20:49 AMEvilgenious

great . But morph i need alphabets. When you will launch. 5g
(If this comment was disrespectful, please report it.)

 
3/10/2007 10:45:59 AMOption Explicit

Hi Tacho57, thanks for the feedback and vote... it works as advertised as far as I know although thousands separators (commas) need tweaking. EvilG, nice to hear from you again. I want to make this an 13-segment display for alphanumeric display but I don't have the time right now. When I can get it done (who knows when) I will email you. Thanks!
(If this comment was disrespectful, please report it.)

 
4/28/2007 9:11:23 PMWilliam

Great work again! I found out about your work from a post on subclassing in vbCity about two weeks ago and I've seen your code for your other submissions. Thanks, 5g.
(If this comment was disrespectful, please report it.)

 
4/29/2007 5:06:41 PMOption Explicit

Resubmitted with a couple minor tweaks that do not affect usage; if you already have this no need to redownload. Also removed the MatrixDisplay control from the .zip; I want to work on it and possibly resubmit as a separate project down the line.
(If this comment was disrespectful, please report it.)

 
5/1/2007 5:10:25 AMRob C

Hi Matt,
I don't think I thanked you for the AM / PM change.
Thanks, that will do fine.
Rob
(If this comment was disrespectful, please report it.)

 
5/2/2007 5:18:00 PMOption Explicit

You're quite welcome Rob... I would like to make an 11-segment display so that all characters A-Z can be displayed but I just don't have the time right now. The slanted digits segments in this scenario would be the time-consumer for me given the fact they have to be displayed at different angles based on the width of the digit.
(If this comment was disrespectful, please report it.)

 
1/28/2008 10:11:35 AMNanni

Excellent code...but
how i can display SMPTE timecode (hh:mm:ss:ff)?
(If this comment was disrespectful, please report it.)

 
8/14/2008 4:01:22 PMTony..

Perhaps someone could help me?

I would love to use this as a Sensor metor from COM5 I have know idea program wise on how to do so. Perhaps you could help? I would like to be able to change the value. Like if the Sensors reading is 1200, I would like to LED to read .08 Etc. Could someone help?
(If this comment was disrespectful, please report it.)

 
12/21/2009 11:18:22 AMkibe

super!
spasibo
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.