Visual Basic components to simulate 7 segment and LEDs? - Page 1
Forum section: electronics / general

author: CraigAB
author_rank: Contributor
timestamp: October 01, 2023, 01:08:03 am
content: Hi,Does anyone know of any free Visual Basic (any version) components (OCX, ActiveX, DLL) that can simulate 7 segment displays, LED's and switches?The only ones that I can find are the paid versions.Regards,Craig

author: Psi
author_rank: Super Contributor
timestamp: October 01, 2023, 02:35:41 am
content: Are you looking for something that "looks pretty", or just something usable for teaching.Writing your own would be pretty easy if all you need to do is draw lines on the canvas to represent whatever segment of the 7-seg is being told to turn on.There are also many fonts available that show all possible numbers/letters for a 7seg display digit.So that might be an option. I've never seen one that shows all possible segment combinations, but one might exist.

author: CraigAB
author_rank: Contributor
timestamp: October 01, 2023, 05:36:51 am
content: Cheers mate.I suppose looking pretty would be nice, but not necessary.I am not sure where to start to create a component/control that would update like a 7 segment or even an LED. I can probably hack my way through the code side.Do you have any pointers to creating such a control?Just so you know, it was a 6809 trainer from Microtec, Ferndale Productions, originally used by Box Hill TAFE in Victoria Australia in the early 1990's that, for the longest time, I wanted to create a simulator for.Regards,Craig

author: mariush
author_rank: Super Contributor
timestamp: October 01, 2023, 05:45:21 am
content: OCX / ActiveX are deprecated technologies, I doubt anyone still supports these in Windows 10 and newer.Also Visual Basic ... even the .net versions are no longer priority for Microsoft... move on.

author: Psi
author_rank: Super Contributor
timestamp: October 01, 2023, 06:10:42 am
content: If it was Delphi I could help, but i know sfa about Visual Basic.It should be pretty simple though, look up an example on creating a visual component.Get that working and then modify so it draws lines on the screen from point A to B based on what segment is being requested by the calling method.It wont look super pretty, but you could improve it by drawing 3 parallel lines with the center one a bit longer at each ends. So the ends look more like a 7 seg. etc..If that will look good enough really depends on what you need it for.Another option is to use an existing component that accepts images, or an array of them.Then you just need to get a big image that has all possible combinations of segments and make a lookup table to copy the right one out of the imageand onto the screen at a specific location. I dunno about visual studio but Delphi lets you easily copy a subsection of a bigger image onto the screen with a single command.

author: mariush
author_rank: Super Contributor
timestamp: October 01, 2023, 06:32:49 am
content: You could also fake it out with a font that has the seven segments digits as characters.Here's a lot of fonts designed for LCD displays :https://www.dafont.com/theme.php?cat=302You could have an array of labels in VB, one for each digit and the optional dot, if you want to have independent control of colors or other things.edit : there's such fonts in other sections, just use keywords like led ,segment , dot matrix etcHere's an example font that's not in the category above, that could work well :https://www.dafont.com/14-segmentled.fontFor standalone LEDs and stuff like that, look up on SVG icons and fonts websites, you'll find led icons and shapes that you could convert to bitmaps and just have a few bitmaps for various states of the led (off, on , fade etc )

author: CraigAB
author_rank: Contributor
timestamp: October 01, 2023, 06:54:24 am
content: Quote from: Psi on October 01, 2023, 06:10:42 amThanks mate I appreciate the help.I'll give it a go.

author: CraigAB
author_rank: Contributor
timestamp: October 01, 2023, 06:57:15 am
content: Quote from: mariush on October 01, 2023, 06:32:49 amThank you.Yea, I know this is dead tech, but that is the stuff I enjoy.The use of fonts is another interesting idea, thank you.

author: PA0PBZ
author_rank: Super Contributor
timestamp: October 01, 2023, 07:58:24 am
content: If I google 'vb.net 7 segment display' I get a lot of useful links, including examples likehttps://www.vbforums.com/showthread.php?877639-How-to-make-7-Segment-led-display-GUI