Einzelnen Beitrag anzeigen

Benutzerbild von Sven Janssen
Sven Janssen

Registriert seit: 22. Jun 2004
Ort: Mayen
187 Beiträge
 
Delphi 4 Professional
 
#12

Re: Focus von Felder besser hervorheben (global)

  Alt 5. Mai 2006, 08:38
Du musst Dir natürlich die Farben merken bevor Du ein Feld selektierst und beim verlassen wieder auf die Ursprungsfarbe setzen.

Delphi-Quellcode:
if (screen.ActiveControl is TCheckbox) then begin
        fieldColorBackgroundBevorGetFocus:=(screen.ActiveControl as TCheckbox).color;
        fieldColorTextBevorGetFocus:=(screen.ActiveControl as TCheckbox).font.color;
        fieldNameBevorGetFocus:=screen.ActiveControl.name;
        fieldFormNameBevorGetFocus:=screen.ActiveCustomForm.name;
        (screen.ActiveControl as TCheckbox).color:=backColor;
        (screen.ActiveControl as TCheckbox).font.color:=fontcolor;
end;
Und dann ca so etwas in der Art :
Delphi-Quellcode:
 for i:=0 to screen.CustomFormCount-1 do begin
        for j:=0 to screen.CustomForms[i].ComponentCount-1 do begin
            if (screen.CustomForms[i].name = fieldFormNameBevorGetFocus) and
                (screen.CustomForms[i].Components[j].name = fieldNameBevorGetFocus) then begin
                if (screen.CustomForms[i].Components[j] is TEdit) then begin
                    (screen.CustomForms[i].Components[j] as TEdit).color:=fieldColorBackgroundBevorGetFocus;
                    (screen.CustomForms[i].Components[j] as TEdit).font.color:=fieldColorTextBevorGetFocus;
                end;
Gruß Sven
:wq /dev/null
He who fights with monsters might take care lest he thereby become a monster - Nietzsche
  Mit Zitat antworten Zitat