Forum > Beginners

Hint Fontsize

(1/2) > >>

seghele0:
How can I define the font size and color of the text in the hint?
 :-[

--- 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";}};} ---procedure TForm1.FormCreate(Sender: TObject);begin  SpeedButton1.Hint :='First line ...' +#13+ 'Second line ...';  SpeedButton2.Hint :='SPButton2 line one' +#13+ 'Second line ...';  Application.ShowHint:= True;  Application.HintColor:= clYellow;  Application.HintHidePause:= 5000;end; 

winni:
Hi!

Not such an easy thing to do.
Use this workaround:



--- 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";}};} ---Type TOKHint = class(THintWindow)     constructor Create(AOwner: TComponent); override;  end;             constructor TOKHint.Create(AOwner: TComponent);begin  inherited Create(AOwner);  with Canvas.Font do    begin      Alignment := taCenter;      Name  := 'Times New Roman';      Height := 12;      Style := [ fsBold ];      color := clYellow;      end;end; procedure TForm1.FormCreate(Sender: TObject);  beginHintWindowClass  := TOKHint;Application.HintColor := clBlue;Application.ShowHint := True;end;
And change the params to your needs.


Winni

wp:
I checked the following code and found it to work on Windows (did not test others):


--- 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";}};} ---procedure TForm1.FormCreate(Sender: TObject);begin  Screen.HintFont.Color := clWhite;  Screen.HintFont.Name := 'Courier New';  Screen.HintFont.Size := 12;  Screen.HintFont.Style := [fsItalic];  Application.HintColor := clBlack; end; 

winni:

--- Quote from: wp on January 04, 2022, 05:14:09 pm ---I checked the following code and found it to work on Windows (did not test others):


--- 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";}};} ---procedure TForm1.FormCreate(Sender: TObject);begin  Screen.HintFont.Color := clWhite;  Screen.HintFont.Name := 'Courier New';  Screen.HintFont.Size := 12;  Screen.HintFont.Style := [fsItalic];  Application.HintColor := clBlack; end; 
--- End quote ---

Hi!

This worked with Delphi  but it did not work for a long time with fpc/Lazarus.

That's why I created the workaround.
Don't know with which version it changed.

Winni

wp:
It is been working back to 1.8.6, and maybe for the others of the 1.8.x series, too (don't have them any more). 1.6.4 and older seem to ignore the font settings (at least on Windows).

Navigation

[0] Message Index

[#] Next page

Go to full version