Bonjour,
Je voudrais mettre en évidence le texte en gras d'un TRichEdit
et j'ai écris ce petit code et ça marche mal. Pas très doué j'aimerais votre aide car j'use le soleil depuis ce matin
Les lignes se décalent ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 procedure TModuloCle.Applique_formatClick(Sender: TObject); var n, t, w : integer; reponse : string; gras : boolean; begin w:=-1; reponse:=''; for n:=0 to memo1.Lines.Count-1 do begin gras:=false; for t:=1 to length(memo1.Lines[n])-1 do begin inc(w); memo1.SelStart:=w; memo1.SelLength:=1; if fsbold in memo1.SelAttributes.style then begin if not(gras) then begin reponse:=reponse+'#G#';// le texte sera en gras gras:=true; end; end else begin if gras then begin reponse:=reponse+'#PG#';// le texte n'est plus en gras gras:=false; end; end; reponse:=reponse+memo1.seltext; end; memo2.lines.add(reponse); memo1.Lines[n]:=reponse; reponse:=''; end; end;
Par avance merci
Partager