Autor Beitrag
Tor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23


D5 Ent
BeitragVerfasst: Fr 08.10.04 09:48 
Hi

Ich hab ein Problem wie kan ich die Farbe einzelner zeilen eines Memos ändern z.B. wen in der Zeile Admin: steht soll der komplete text Blau werden und wen ein anderer schreibt soll eine andere Farbe gewählt werden.
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Fr 08.10.04 09:50 
Dafür musst du ein RichEdit nehmen.

Gruß,
Jörg

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
Tor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23


D5 Ent
BeitragVerfasst: Fr 08.10.04 10:07 
Und wie geht das Im Richedit? ich habe damit noch nicht gearbeitet
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Fr 08.10.04 10:27 
Schau dir mal in der Delphi-Hilfe beim RichEdit die Eigenschaft SelAttributes an.

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
Tor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23


D5 Ent
BeitragVerfasst: Fr 08.10.04 10:29 
THX probier ich gleich mal
simplex3
Hält's aus hier
Beiträge: 14

Win 98, Win 2000, Linux
D7.1 Prof, D8 Prof
BeitragVerfasst: Fr 08.10.04 12:20 
Moin.
Habe da mal was aus diversen Hilfen zusammengezimmert und angepasst:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
procedure TForm1.Button1Click(Sender: TObject);
var
  FoundAt: LongInt;
  StartPos, ToEnd: Integer;
  row, col, len: LongInt;
begin
  with RichEdit1 do
  begin
    { Suche hinter aktueller Markierung beginnen (falls vorhanden), }
    { andernfalls am Textanfang starten. }
    if SelLength <> 0 then
      StartPos := SelStart + SelLength
    else
      StartPos := 0;

    { ToEnd ist die Länge von StartPos bis zum Textende im RTF-Eingabefeld }

    ToEnd := Length(Text) - StartPos;

    FoundAt := FindText('Admin', StartPos, ToEnd, [stMatchCase]);
    if FoundAt <> -1 then
    begin
      SetFocus;
      SelStart := FoundAt;
      // aktuelle Zeile
      row:= SendMessage(RichEdit1.Handle, EM_LINEFROMCHAR, RichEdit1.SelStart, 0);
      // aktuelle Spalte
      col:= SendMessage(RichEdit1.Handle, EM_LINEINDEX, row, 0);
      // Länge der Zeile
      len:= SendMessage(RichEdit1.Handle, EM_LINELENGTH, col, 0);
      col:= RichEdit1.SelStart - col;

      // Startposition der Markierung
      if (col = 0) then
        SelStart := FoundAt
      else
        SelStart := FoundAt - col;

      // Länge der Markierung
      SelLength := len;

      SelAttributes.Color :=  clBlue;
      SelAttributes.Style := [fsBold];
    end;
  end;
end;

_________________
Ceterum censeo, microsoftem esse delendam.
Tor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23


D5 Ent
BeitragVerfasst: Fr 08.10.04 12:35 
THX für deine Hilfe Simplex3 probier ich gleich mal aus.

_________________
Ich Will doch nur die Welt verbessern! :) ...
Aber Gott gibt mir die Scripte nicht. :(