GSM-Forum

GSM-Forum (https://forum.gsmhosting.com/vbb/)
-   GSM Programming & Reverse Engineering (https://forum.gsmhosting.com/vbb/f83/)
-   -   how to change richedit selection color (https://forum.gsmhosting.com/vbb/f83/how-change-richedit-selection-color-1439651/)

GTunlocker 03-07-2012 09:22

how to change richedit selection color
 
hi all

help me pleas

uses Richedit;

how to change richedit selection color
select is black, i need blue like Tmemo

br

darmiles 03-07-2012 14:57

SelStart := GetTextLen;
SelAttributes.Size := 10;
//add one unformatted line
SelText := 'test1' + #13#10;

//add some normal font text
//SelText := 'Formatted lines in RichEdit' + #13#10;
SelText := 'test2';
///SelAttributes.Size := 10;

//add bold + red
SelAttributes.Style := [fsBold];
SelAttributes.Color := clRed;
SelText := ':';
SelAttributes.Style := [fsBold];
SelAttributes.Color := clBlue;
SelText := 'test2';
//only bold
SelAttributes.Color := clGreen;
SelText := 'test3:';
///////////



//add italic + blue
SelAttributes.Style := [fsbold];
SelAttributes.Color := clpurple;
SelText := 'test4';

//new line
SelText := #13#10;

//add normal again
SelAttributes.Style := [fsItalic];
SelAttributes.Size := 10;
SelAttributes.Color := cllime;
SelText := '';

neXt time USE GOOGLE BEFORE MAKING LAZY THREAD LIKE THIS

darmiles 03-07-2012 15:09

procedure TForm1.Button1Click(Sender: TObject);
BEGIN
with richEdit1 do
begin
Richedit1.clear;

SelStart := GetTextLen;
SelAttributes.Size := 10;
//add one unformatted line
SelText := 'MY NAME IS DARWIN' + #13#10;

//add some normal font text
/////SelText := 'LAZY TEAM' + #13#10;
SelText := 'DARWIN' + #13#10;
//bigger text
///SelAttributes.Size := 10;

//add bold + red
SelAttributes.Style := [fsBold];
SelAttributes.Color := clRed;
SelText := 'DARMILES';
SelAttributes.Style := [fsBold];
SelAttributes.Color := clBlue;
SelText := ''+ #13#10;
//only bold
SelAttributes.Color := clGreen;
SelText := 'LEVEL5TEAM';
///////////



//add italic + blue
SelAttributes.Style := [fsbold];
SelAttributes.Color := clpurple;
SelText := 'GSMHOSTING';

//new line
SelText := #13#10;

//add normal again
SelAttributes.Style := [fsItalic];
SelAttributes.Size := 10;
SelAttributes.Color := cllime;
SelText := '';


SelAttributes.Size := 10;
SelAttributes.Style := [fsItalic];
SelAttributes.Color := clBlue;
SelText := ''#13#10;
SelText :='';

richedit1.lines.add(' ');
SelAttributes.Size := 10;
SelAttributes.Style := [fsbold];
SelAttributes.Color := clfuchsia;
SelText := 'TEST1'#13#10;

end;

end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with richEdit1 do
begin
Richedit1.clear;

SelStart := GetTextLen;
SelAttributes.Size := 10;
//add one unformatted line
SelText := 'MY NAME IS DARWIN' + #13#10;

//add some normal font text
/////SelText := 'LAZY TEAM' + #13#10;
SelText := 'DARWIN' + #13#10;
//bigger text
///SelAttributes.Size := 10;

//add bold + red
SelAttributes.Style := [fsBold];
SelAttributes.Color := clRed;
SelText := 'DARMILES';
SelAttributes.Style := [fsBold];
SelAttributes.Color := clBlue;
SelText := ''+ #13#10;
//only bold
SelAttributes.Color := clGreen;
SelText := 'LEVEL5TEAM';
///////////



//add italic + blue
SelAttributes.Style := [fsbold];
SelAttributes.Color := clpurple;
SelText := 'GSMHOSTING';

//new line
SelText := #13#10;

//add normal again
SelAttributes.Style := [fsItalic];
SelAttributes.Size := 10;
SelAttributes.Color := cllime;
SelText := '';


SelAttributes.Size := 10;
SelAttributes.Style := [fsItalic];
SelAttributes.Color := clBlue;
SelText := ''#13#10;
SelText :='';

richedit1.lines.add(' ');
SelAttributes.Size := 10;
SelAttributes.Style := [fsbold];
SelAttributes.Color := clfuchsia;
SelText := 'TEST1'#13#10;

end;
end;
end.

orbita 03-07-2012 16:43

edited my message :) :)

GTunlocker 03-07-2012 18:11

Quote:

Originally Posted by darmiles (Post 8211963)
SelStart := GetTextLen;
SelAttributes.Size := 10;
//add one unformatted line
SelText := 'test1' + #13#10;

//add some normal font text
//SelText := 'Formatted lines in RichEdit' + #13#10;
SelText := 'test2';
///SelAttributes.Size := 10;

//add bold + red
SelAttributes.Style := [fsBold];
SelAttributes.Color := clRed;
SelText := ':';
SelAttributes.Style := [fsBold];
SelAttributes.Color := clBlue;
SelText := 'test2';
//only bold
SelAttributes.Color := clGreen;
SelText := 'test3:';
///////////



//add italic + blue
SelAttributes.Style := [fsbold];
SelAttributes.Color := clpurple;
SelText := 'test4';

//new line
SelText := #13#10;

//add normal again
SelAttributes.Style := [fsItalic];
SelAttributes.Size := 10;
SelAttributes.Color := cllime;
SelText := '';

neXt time USE GOOGLE BEFORE MAKING LAZY THREAD LIKE THIS


Thanks darmiles hehe :D :D :D:D:D

mustipusti 03-07-2012 22:44

Quote:

Procedure Addlog(S:string;Color:TColor);
var
Posit:Integer;
Time:String;
begin
Time := Timetostr(Now);
Posit := Length(Mainform.Log.Text);
Mainform.Log.Lines.Add('['+Time+'] ' + s);
Mainform.Log.SelStart := Posit;
Mainform.Log.SelLength := length(time)+3;
Mainform.Log.SelAttributes.Color := clhighlight;
Mainform.Log.SelStart := Posit + length(time)+3;
Mainform.Log.SelLength := Length(s);
Mainform.Log.SelAttributes.Color := Color;
Mainform.Log.SelStart := Length(Mainform.Log.Text);
SendMessage(Mainform.Log.handle, EM_SCROLLCARET,0,0);
end;

This Procedure will Show

[time] < clhighlight + String(s) < Color


All times are GMT +1. The time now is 09:07.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -

Page generated in 0.16949 seconds with 6 queries

SEO by vBSEO