[twinBASIC] ColorFontLabel - Color emojis, angled text, and more (w/ OCX for VB6/VBA)
ColorFontLabel v1.3
ColorFontLabel is a UserControl/ActiveX Label Control that supports Color Fonts-- fonts that have characters with multiple colors, most commonly used for color emojis that are still copy/paste-able text and not images. Powered with Direct2D/DirectWrite.
Additional features
Font effects (bold, italic, underline, strikethru, condense/expand) can be applied only to a specific range.
Angled text
Color gradients (linear and radial)
Locale can be specified
Several options for word wrap mode
Set line spacing
Antialiasing options
Can act as a drop target for DragDrop from other apps and displays the fancy icons like Explorer.
Mouse events including MouseWheel
Background picture property with stretch or offset options
Normal Label properties like Alignment, RightToLeft, ForeColor/BackColor, etc.
The project is provided as both a UserControl you can use within twinBASIC projects, and as a OCX control tested to work in VB6 and VBA (both 32 and 64bit). ColorFontLabel.twinproj can be used to build the OCX, and ucColorFontLabel.tbcontrol/.twin are the files you'd import to use in a project, with ucColorFontTest.twinproj being a test project for this type.
Requirements
-Color fonts are only supported on Windows 8 and above. The control should work on Windows 7, but emojis etc would be in black and white.
-For building or IDE use of the tbcontrol version, my WinDevLib package, v9.1.566+, is required (References->Available packages). Projects use the new package linking option so it's no longer embedded by default, which means I can once again post it here!
-The latest twinBASIC Beta is recommended, and 828+ is required, to build the OCX or read the test project.
Changelog
v1.3 (07 Jul 2025)
- Bug fix: Font was smaller than regular label with same font/size.
- Bug fix: PictureStretch size wrong when DPI awareness enabled.
v1.2 (07 Jul 2025)
- Added support for Picture property to set a background image. PictureStretch property sets whether it's stretched to fill the label. If not, you can set an x/y offset with PictureOffsetX/Y.
v1.1 (05 Jul 2025)
- Now using quicker/more stable DC render target. Thanks to Wayne Phillips for this contribution. This works better in the IDE and faster at runtime.
(Bug fix) Size/position badly broken when DPI awareness enabled.
Ok, with your Label OCX, you gave me an idea, make the button I created that has the option to function as a label, although not windoless...
I already have it working as a checkbox and option box, apart from a normal button... I have gradients, and well, I think it could be useful, I haven't tried it with TwinBasic yet, to see if it's really compatible with 64-bit...
The conversion program to "option explicit" and declaring all the variables, I know it is not very necessary, but I think it is something, being able to declare all the variables with true type, or approximate, I think it will be good, and that, the key was to extract the information from the "Object Browser", there Claude Ai has behaved excellently, I hope to have it complete before August...
Good luck and go ahead with TwinBasic, I, believe it or not, know that the program that proves that the planets have influence, I know it will be a bomb - if they don't block me, because I am completely convinced, with arguments, that those who rule the world know it, but it is too powerful a knowledge not to want to keep it to themselves, I know that you will consider me perhaps hallucinated, or something similar, but I know that there is enough evidence that it is real, and it comes from the most distant antiquity, and in ancient times they were not stupid, you only have to see the constructions they built without means -, and there, if things go well for me financially, well I am thinking of moving to Bulgaria - within the EU it is the one that imposes the least taxes, although for me, changing countries is like changing shirts, I have lived in many, none of them English-speaking, but in many, my mother worked in Embassies -, but if things go well for me, as much as I can, financially I mean, and Without asking anything in return, you could use me... Because I consider the project very necessary...