Einzelnen Beitrag anzeigen

Benutzerbild von mirage228
mirage228

Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
 
Delphi 2010 Professional
 
#6

Re: über sendmessage Font.color einstellen

  Alt 8. Apr 2004, 07:52
Zitat von kiar:
hallo mi....

das musste mir mal erklären?
wo stell ich da die farbe ein.

danke raik
Hoi,

du könntest WinAPI mäßig einen Font erstellen:
(näheres zu CreateFont unter MSDN-Library durchsuchenCreateFont --> http://msdn.microsoft.com/library/de...ntext_8fp0.asp - dort steht auch, wie du die Farbe verändern kannst. )

Delphi-Quellcode:
var
  MyFont: HFONT;
begin
MyFont := CreateFont(10, 0, 0, 0, 0, 0, 0, 0, ANSI_CHARSET,
            OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
            DEFAULT_PITCH, 'Arial');
SendMessage(Handle, WM_SETFONT, Integer(MyFont), Integer(True));
end;
oder mit TFont
Delphi-Quellcode:
var
  Font: TFont;
begin
  Font := TFont.Create;
  try
    Font.Assign(Edit1.Font);
    Font.Color := clRed;
    SendMessage(Handle, WM_SETFONT, Integer(Font.Handle), Integer(True));
  finally
    Font.Free;
end;
Beides ungetestet, sollte aber funktionieren.

mfG
mirage228
David F.

May the source be with you, stranger.
PHP Inspection Unit (Delphi-Unit zum Analysieren von PHP Code)
  Mit Zitat antworten Zitat