Forum > Beginners

[SOLVED]SpeedButton Font

(1/1)

Petrus Vorster:
Hi All

I am playing with the transparency on the Speedbutton.
It works great, but the application has a background that varies and loads the current Windows background for a backdrop.

That renders the text part of the button almost useless since the varying of the background makes some text hard to read.
Microsoft has a black shadow/background on the text which is not part of the font. I tried some outlined fonts but that did not help.

I assume its going to be a lot of work to make a back background for the text?

This is a learning exercise, not really critical, but I would like to know how to do that.

-Thanks for all the help.

Peter

jamie:
AI created example, well part it. It was quicker for me to copy and paste.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- // Calculate center position  X := (ClientWidth - Canvas.TextWidth(TextStr)) div 2;  Y := (ClientHeight - Canvas.TextHeight(TextStr)) div 2;   // Draw shadow (darker, bottom-right)  Canvas.Font.Color := clGray;  Canvas.TextOut(X + 2, Y + 2, TextStr);   // Draw highlight (lighter, top-left)  Canvas.Font.Color := clWhite;  Canvas.TextOut(X, Y, TextStr);end; 
DO that in the OnPaint event of the speed button and also disable the Show caption in the OI so you don't get a double print.

The TextStr would be replaced with the CAPTION of the button.

Jamie

Petrus Vorster:
Thank you for trying.

This just paints a white block somewhere on the screen.
I tried a few AI options myself.
One of them got the text and shadow right , but it wont draw the text below the Glyph.

There is another option, but its very hard to find free. Adobe has a solid white font with a black border.
In other words a SOLID outlined font that will do the trick, but getting it has proven quite challenging.

Oh well, this is not critical, its just a learning exercise.

-Peter

Xenno:
Do you have to use TSpeedButton?
How about an image and plain text as my reply (https://forum.lazarus.freepascal.org/index.php/topic,74527.msg588055.html#msg588055) in your other thread?

Petrus Vorster:
Thank you.

This is a much simpler approach.

-Peter

Navigation

[0] Message Index

Go to full version