Solved

Richedit Select Color

Posted on 2001-07-28
18
1,620 Views
Last Modified: 2013-11-22
I realize that you can not change the color of a Richedit when it has selected text.

What I am trying to do is to create a story book that reads to you.  It highlights a specific sentence as it reads it.  It then highlights the next sentence to read.

I have figured that I could layout a bunch of TLabel's and just turn on and off the transparency when I need it to be colored.

I wonder if anyone else has some nifty idea that would make this section a whole lot easier.

I am working with Delphi 5 Pro.
0
Comment
Question by:perkley
  • 4
  • 4
  • 4
  • +4
18 Comments
 
LVL 6

Expert Comment

by:MannSoft
ID: 6330548
I put a TRichEdit, TEdit and TButton on a form and came up with this code.  Its nasty, but it works :)

Just enter a number into the TEdit, press the TButton, and that line turns Red!

procedure TForm1.Button1Click(Sender: TObject);
var
   I: Integer;
   J: Integer;
   S: String;
begin
     try
        I := StrToInt(Edit1.Text);
     except
           Exit;
     end;
     if (I < 1) or (I > RichEdit1.Lines.Count) then
        Exit;
     if (I = 1) then
        RichEdit1.SelStart := 0
     else
     begin
          S := '';
          for J := 0 to I - 2 do
              S := S + RichEdit1.Lines[J];
          RichEdit1.SelStart := Length(S) + ((I - 1) * 2);
     end;
     RichEdit1.SelLength := Length(RichEdit1.Lines[I - 1]);
     RichEdit1.SelAttributes.Color := clRed;
end;
0
 

Author Comment

by:perkley
ID: 6330672
I am not seeing it work.  The highlight color is not red, it is still black.  When I deselect it then the text is red, but I don't want the text to be red, I want the highlight color to be red.  The text will remain black.
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6330702
If the user is not able to scroll the text in this RichEdit then you may want to compleatly take over drawing all of the text on a paintbox, panel or other component with a Canvas using

DrawText(PaintBox1.Canvas.Handle ,PChar(TextString), -1, Rect1, DT_SINGLELINE or DT_VCENTER or DT_CENTER);

then you can put the Text anywhere, any color, any color Background (red if you want it to look selected), any Font, Bold, large or small. This is more work than just having characters displayed by a RichEdit, but for special Graphical output it may be better than beating and kicking a RichEdit, or hiding and showng labels ect.
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6331159
listening
0
 
LVL 17

Expert Comment

by:inthe
ID: 6331618
hi,
the richedit wont change highlight color ,even using setsyscolors() api all other hilight colors for tedit etc in delphi and for other windows will change but not the richedit.using richedit2 you can change the background color of the text but thats about it.
its a windows thing to make sure no matter what the color of the text in the richedit it will still be readable when highlighted.
0
 

Expert Comment

by:Hamilton
ID: 6332405
Sorry, I don't know it exactly at the moment, but isn't it possible to use
  RichEdit1.SelAttributes.Color := clRed;
very simply? I think something like this should do it.
Regards, Hamilton.
0
 
LVL 17

Expert Comment

by:inthe
ID: 6332557
no that just change the color of the text that is currently selected not the actual highlight color,so when text is unselected it will just be red.
0
 
LVL 6

Expert Comment

by:MannSoft
ID: 6332878
I wrote a component awhile ago...it was basically so I could have the look of a console application embedded into a GUI window (so I could write a non-console ANSI editor).  You can change both the foreground and background colour, so you can sort of make it look like a line is being highlighted.  (Write a page of text in regular colour and then rewrite it with the new colour as each line is being read or whatever).  If you are interested I can put the source up on my website.
0
 

Expert Comment

by:Hamilton
ID: 6333484
Hi!
Sorry, I think I have just understood the problem you have. You don't want to change the color of the letters, but the color of the selection rectangle. Am I right?
Regards, Hamilton.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

by:rondi
ID: 6333709
Here's an idea:

Since windows sets the highlight color depending on the
text/font color to make sure the text is visibe,
why don't you try playing with the actual text color
so that you find a color that forces Windows to set
the highlight color to red (or whatever color you want)

rondi.
0
 

Author Comment

by:perkley
ID: 6335483
MannSoft, I am interested to see your code.

Hamilton, that is correct, I want to change the highlight color.

Rondi,  I tried your suggestion, but the highlight is always black, only the text changes different colors.  For example:  If I select it and tell it to be green, then the text turns purple with black highlight.  When I deselect then it is green.  Therefore this won't give me what I want.

Slick812, I think your idea would work, but seeing how I have to do an entire story and some lines will be highlighted only partially because of the sentence length, then it seems to me like a lot more work.  I will keep it in mind though if nothing else comes along better.
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6336011
hello perkley, Here is and app I pieced together from a couple of things I did before. It will show Text you HighLight in a RichEdit with a Red Background. It draws on the Canvas of the RichEdit, so the Red Select is NOT redrawn when the RichEdit is Repainted. You will have to add that if you need it to show after your app loses focus. I only put a few comments, let me know if you need more info. The Red Selection is limited to 2 lines of text in this and Is ReadOnly while the Red Select is shown.
The RichEdit1 is default except WordWrap is False; I did not feel like building the searches for #10 and #13 linebreaks;

Here is the Code
+ + + + + + + + + + + + + + + + + +

unit RichEd1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    RichEdit1: TRichEdit;
    but_ChangeRed: TButton;
    but_Exit: TButton;
    but_Restore: TButton;
    procedure but_ExitClick(Sender: TObject);
    procedure but_ChangeRedClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure but_RestoreClick(Sender: TObject);
    procedure RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
  private
    { Private declarations }
    RichCanvas: TCanvas;
    Reds: Boolean;
    Procedure RedSelect;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.but_ExitClick(Sender: TObject);
begin
Close;
end;

procedure TForm1.RedSelect;
{this uses RichCanvas.TextOut to
redraw the selected Text with Red background}
const
EM_EXLINEFROMCHAR = WM_USER + 54;
var
SelString: String;
ClarPos: TPoint;
TH, BW, CharLoca, LineNum, LinePos, i: Integer;
begin
if RichEdit1.SelLength = 0 then Exit;
RichCanvas.Brush.Color := clRed;
RichCanvas.Font := RichEdit1.Font;
SelString := RichEdit1.SelText;
ClarPos := RichEdit1.CaretPos;
{this RichEdit1.CaretPos is not a Pixel Point but a Line Nunber and Charater Point}

{set ReadOnly to true so keboard input will not cause the RedSelect to be lost}
RichEdit1.ReadOnly := True;
{Reds is used to Refresh on MouseDown}
Reds := True;
CharLoca := RichEdit1.SelStart;
LinePos := 0;
TH := RichCanvas.TextHeight('D');
BW := RichEdit1.BorderWidth;
LineNum := SendMessage(RichEdit1.Handle,EM_EXLINEFROMCHAR,0,CharLoca);
for i := 0 to LineNum-1 do
begin
LinePos := LinePos+Length(RichEdit1.Lines[i]);
end;
{LineNum*2 is my Lazy way of dealing with the #10 and #13 lineBreak charaters}
LinePos := CharLoca - LinePos-(LineNum*2);
{I only made this to do a Max of 2 selected lines}
{test to see if the Selection goes more than one line}
if RichEdit1.SelLength > Length(RichEdit1.Lines[LineNum]) - LinePos then
begin
RichCanvas.TextOut(RichCanvas.TextWidth(Copy(RichEdit1.Lines[LineNum], 0, LinePos))+2, ((LineNum) * TH)+BW, Copy(SelString, 0, Length(RichEdit1.Lines[LineNum])- LinePos)+'  '{these 2 spaces cover the LineBreak Charaters});
RichCanvas.TextOut(BW, ((LineNum+1) * TH)+BW, Copy(RichEdit1.Lines[LineNum+1], 0,RichEdit1.SelLength-(Length(RichEdit1.Lines[LineNum])- (LinePos-2))));
end else
RichCanvas.TextOut(RichCanvas.TextWidth(Copy(RichEdit1.Lines[ClarPos.y], 0, ClarPos.x-RichEdit1.SelLength)), (ClarPos.y * TH)+BW, SelString);
end;

procedure TForm1.but_ChangeRedClick(Sender: TObject);
{this button will place the RedSelect where you want it,
 withOUT any text being selected by the user}
begin
Reds := True;
RichEdit1.SelLength := 0;
RichEdit1.Refresh;
{you will have to place the location with TextWidth and TextHeight}
RichCanvas.TextOut(RichCanvas.TextWidth('Rich')+RichEdit1.BorderWidth, ({LineNumber}0 * RichCanvas.TextHeight('D'))+RichEdit1.BorderWidth, 'Edit');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
{you need to get the RichEdit1 HDC to a delphi compatible Canvas}
RichCanvas := TCanvas.Create;
RichCanvas.Handle := GetDC(RichEdit1.Handle);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
// Free Canvas
RichCanvas.Free;
end;

procedure TForm1.but_RestoreClick(Sender: TObject);
{this button restores the RichEdit to be Writable again}
begin
RichEdit1.ReadOnly := False;
{Remove all Selections is not really nessary}
RichEdit1.SelLength := 0;
Reds := False;
{Refresh removes any RedSelect}
RichEdit1.Refresh;
RichEdit1.SetFocus;
end;

procedure TForm1.RichEdit1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if Reds then
RichEdit1.Refresh;
RedSelect;
end;

end.

 - - - - - - - - - - - - - - - - - - - - -

you did not say if the user would be making the selections or if you just wanted to show certain text in the story with a red background for Attention. look at the TForm1.but_ChangeRedClick procedure if all you need is the display in red for attention.
0
 
LVL 6

Expert Comment

by:MannSoft
ID: 6341047
perkley:

I uploaded the 2 files for the component to my homepage (http://www.mannsoft.ca).  The links should be in the topmost news article.  
Ive been meaning to finish it but havent had time lately, so the code is still fairly messy.  But it should (hopefully) do what you want though.  Just let me know if you have any questions
0
 
LVL 33

Accepted Solution

by:
Slick812 earned 50 total points
ID: 6342917
I did some presetation apps which used graphics, sound and text to Inform the user. I tried memos and RichEdits for Text, but they didn't do any 'Special Effects'. So I used a PaintBox for Text display and could do all sorts of backgrounds, colors, Flashing, moving, fading, blending, zooming, ect. here is some code I hope you will consider. you can just load a .txt file in it to be displayed as your story.

+ + + + + + + + + + + + + + + + + +

unit PaintBoxA;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    PaintBox1: TPaintBox;
    but_Exit: TButton;
    but_Scroll: TButton;
    but_HiLight: TButton;
    but_Read: TButton;
    but_DrawOn: TButton;
    but_LoadFile: TButton;
    procedure but_ExitClick(Sender: TObject);
    procedure PaintBox1Paint(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure but_ScrollClick(Sender: TObject);
    procedure but_HiLightClick(Sender: TObject);
    procedure but_LoadFileClick(Sender: TObject);
    procedure but_ReadClick(Sender: TObject);
    procedure but_DrawOnClick(Sender: TObject);
  private
    { Private declarations }
    Read: Boolean;
    PagePosition, HiLight,Period,Period1, Line, OldPagePos: Integer;
    FontA, FontB, FontC: TFont;
    hFont1, {hFont2,} hFont3: HWND;
    Story1: TStringList;
    BackBit: TBitmap;
    procedure TheEnd;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.but_ExitClick(Sender: TObject);
begin
Close;
end;

procedure TForm1.PaintBox1Paint(Sender: TObject);
var
RectC: Trect;
i, X, Y, TH: Integer;
begin
PaintBox1.Canvas.Brush.Color := clWindow;
PaintBox1.Canvas.Font := FontA;
RectC := PaintBox1.ClientRect;
TH := PaintBox1.Canvas.TextHeight('D');
{if you dont use a bitmap background then
PaintBox1.Canvas.FillRect(RectC);}
PaintBox1.Canvas.Brush.Style := bsClear;
{while Y, fills the PaintBox with a small Bitmap}
Y := 0;
  while Y < PaintBox1.Height do
    begin  // While Y
    X := 0;
    while X < PaintBox1.Width do
      begin  {5}
      PaintBox1.Canvas.Draw(X, Y, Backbit);
      Inc(X, BackBit.Width);
      end; {5}
    Inc(Y, BackBit.Height);
    end; // While Y
if HiLight <> 4 then
for i:= 0 to 4 do
  PaintBox1.Canvas.TextOut(5, (TH*i)+5, Story1[i+PagePosition]);
{this places the story1 text in the PaintBox}
PaintBox1.Canvas.Brush.Color := clRed;
PaintBox1.Canvas.Brush.Style := bsSolid;
if Read then
begin // Read
Period1 := Period1 + Period;
Repeat
Period := Pos('.',Copy(Story1[Line],Period1+1,Length(Story1[Line])));
if Period = 0 then
begin
PaintBox1.Canvas.TextOut(PaintBox1.Canvas.TextWidth(Copy(Story1[Line], 0, Period1))+5, (TH*(Line-PagePosition))+5, Copy(Story1[Line], Period1+1, Length(Story1[Line])));
Period1 := 0;
Inc(Line);
if Line = Story1.Count  then
Period := 1;
end;
Until Period <> 0;
if Line < Story1.Count  then
PaintBox1.Canvas.TextOut(PaintBox1.Canvas.TextWidth(Copy(Story1[Line], 0, Period1))+5, (TH*(Line-PagePosition))+5, Copy(Story1[Line], Period1+1, Period))
else
  begin
  Line := 0;
  Period := 0;
  Period1 := 0;
  TheEnd;
  end;
end // Read
else
case HiLight of
{this changes what is drawn on the canvas by what you have set HiLight too}
0: Begin
   {nothing extra drawn}
   end;
1: Begin
   PaintBox1.Canvas.TextOut(PaintBox1.Canvas.TextWidth(Copy(Story1[1+PagePosition], 0, 18))+5, (TH*1)+5, Copy(Story1[1+PagePosition], 19, 17));
   end;
2: Begin
   PaintBox1.Canvas.TextOut(PaintBox1.Canvas.TextWidth(Copy(Story1[2+PagePosition], 0, 36))+5, (TH*2)+5, Copy(Story1[2+PagePosition], 37, Length(Story1[2+PagePosition])));
   end;
3: Begin
   PaintBox1.Canvas.TextOut(5, (TH*3)+5, Copy(Story1[3+PagePosition], 0, 17));
   end;
4: Begin
   TheEnd;
   end;
end;
{use drawEdge for an TMemo edge look}
DrawEdge(PaintBox1.Canvas.Handle, RectC, EDGE_SUNKEN, BF_RECT);
OldPagePos := PagePosition;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Period := 0;
Period1 := 0;
PagePosition := 0;
OldPagePos := 0;
HiLight := 0;
Line := 0;
Read := False;
{Story1 string list will have all the lines that can be displayed}
Story1 := TStringList.Create;
Story1.Add('0 Once Upon a time. there was a Delphi Programer.');
Story1.Add('1 Small Sentence Story Sentence A. the Short Sentence No. 2');
Story1.Add('2 Small Sentence Story Sentence B Short Sentence No 3');
Story1.Add('3 Small Sentence. Story Sentence C. Short Sentence No. 4');
Story1.Add('4 Small Sentence. Story Sentence D. Short Sentence No. 5');
Story1.Add('5 Small Sentence. Story Sentence E. Short Sentence No. 6');
Story1.Add('6 Small Sentence. Story Sentence F. Short Sentence No. 7');
Story1.Add('7 Small Sentence. Story Sentence. Short Sentence No. 8');
Story1.Add('8 Small Sentence. Story Sentence. Short Sentence No. 9');
{ or use Story1.LoadFromFile('E:\Compile\Story1.txt');
or load from resource}
FontA := TFont.Create;
{FontA.Name := 'Times New Roman';
you can leave out the createFont and just name FontA to 'Times New Roman' but if that font
is not available then you will likely get MS San Serif}
hFont1 := CreateFont(-11,6,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_TT_PRECIS,
   CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,VARIABLE_PITCH or FF_ROMAN ,'uhqgtxr'{'Times New Roman'});
FontA.Handle := hFont1;
{if you use CreateFont then you will likely get Times Roman if your font ain't there and you put FF_ROMAN}
{you can adjust font size to the Screen Res
if Screen.Width < 790 then
FontA.Size := 9 else
if Screen.Width < 1000 then
FontA.Size := 11 else
if Screen.Width < 1100 then
FontA.Size := 12 else
if Screen.Width < 1200 then
FontA.Size := 13 else
if Screen.Width < 1500 then
FontA.Size := 14 else
FontA.Size := 16;
and you will have to adjust Form1 size also}
FontA.Size := 11;
PaintBox1.Canvas.Font := FontA;
{you can never tell what font will be loaded if the font you name is NOT availible,
so adjust the size of your Paintbox to match the font size. Get the width of Longest line you will display }
PaintBox1.Width := PaintBox1.Canvas.TextWidth(Story1[1])+18{add some extra space};
{Make the PaintBox.Height = 5 lines of text
you change this to increase the height}
PaintBox1.Height := (PaintBox1.Canvas.TextHeight('M')*5)+10;
FontB := TFont.Create;
FontB.Name := 'Arial';
{hFont2 := CreateFont(-10,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_TT_PRECIS,
   CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,VARIABLE_PITCH or FF_SWISS,'Arial');
FontB.Handle := hFont2;}
FontB.Size := 50;
FontB.Color := clRed;
FontC := TFont.Create;
{FontC.Name := 'Comic Sans MS';}
hFont3 := CreateFont(14,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_TT_ONLY_PRECIS,
   CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,VARIABLE_PITCH or FF_SWISS,'Comic Sans MS');
FontC.Handle := hFont3;
FontC.Size := 14;
FontC.Style := [fsBold];
FontC.Color := clFuchsia;
DoubleBuffered := True;
{it helps to Doublebuffer with a paintbox}
BackBit := TBitmap.Create;
BackBit.LoadFromFile('E:\Compile\Old Paper.bmp');
{a web page type background bitmap to tile}
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
FontA.Free;
FontB.Free;
FontC.Free;
DeleteObject(hFont1);
{DeleteObject(hFont2);}
DeleteObject(hFont3);
BackBit.Free;
end;

procedure TForm1.TheEnd;
begin
PaintBox1.Canvas.Font := FontB;
PaintBox1.Canvas.Brush.Color := clAqua;
PaintBox1.Canvas.Ellipse(10,5,PaintBox1.Width-10,PaintBox1.Height-5);
PaintBox1.Canvas.Brush.Style := bsClear;
PaintBox1.Canvas.TextOut(50, 13, 'The END');
PaintBox1.Canvas.Brush.Style := bsSolid;
PaintBox1.Canvas.Font := FontA;
end;

procedure TForm1.but_ScrollClick(Sender: TObject);
{this will scroll the page 1 line on each click}

begin
HiLight := 0;
Read := False;
if PagePosition < Story1.Count-5 then
Inc(PagePosition) else PagePosition := 0;
PaintBox1.Refresh;
end;

procedure TForm1.but_HilightClick(Sender: TObject);
{keep clicking to show various Red HighLights}
begin
Read := False;
PagePosition := 0;
if HiLight < 5 then
Inc(HiLight);
PaintBox1.ReFresh;
end;

procedure TForm1.but_LoadFileClick(Sender: TObject);
{this loads a file to change the story}
begin
Story1.Clear;
Story1.LoadFromFile('E:\Compile\Story.txt');
{or from resource}

{reset variables}
Read := False;
PagePosition := 0;
OldPagePos := 0;
HiLight := 0;
Line := 0;
Period := 0;
Period1 := 0;
PaintBox1.Refresh;
end;

procedure TForm1.but_ReadClick(Sender: TObject);
{keep clicking this to Red HiLight one sentence
at a time in the story as if you were reading it}
var
X,Y,i,z: Integer;
RectC: TRect;
begin
HiLight := 0;
z := 0;
if Line = 0 then PagePosition := 0;
if (Line > 3) and (PagePosition < Story1.Count- 5) then
PagePosition :=  Line-1;



if (OldPagePos <> PagePosition) and (PagePosition <> 0) then
begin
{this visually moves the text so the user can know which direction the scrolling
is going. try it without this to see the difference}
PaintBox1.Canvas.Brush.Style := bsClear;
RectC := PaintBox1.ClientRect;
PaintBox1.Canvas.Font := FontA;
Repeat
Y := 0;
  while Y < PaintBox1.Height do
    begin  // While Y
    X := 0;
    while X < PaintBox1.Width do
      begin  {5}
      PaintBox1.Canvas.Draw(X, Y, Backbit);
      Inc(X, BackBit.Width);
      end; {5}
    Inc(Y, BackBit.Height);
    end; // While Y
  for i:= 0 to 4 do
  PaintBox1.Canvas.TextOut(5, (PaintBox1.Canvas.TextHeight('D')*i)+4-(6*z)-(PaintBox1.Canvas.TextHeight('D') div 2), Story1[i+OldPagePos]);
  DrawEdge(PaintBox1.Canvas.Handle, RectC, EDGE_SUNKEN, BF_RECT);
  PaintBox1.Invalidate;
  Sleep(120);
  Inc(z)
until z>1;
Read := False;
PaintBox1.Refresh;
Sleep(500);
end;



Read := True;
PaintBox1.Refresh;
end;

procedure TForm1.but_DrawOnClick(Sender: TObject);
{this draws on the paintbox. you can do most graphics effects,
draw bitmaps and Icons, draw Rectangles around text, do movement,
change colors, flash text or bitmaps, fading and blending}
var
space:Integer;
TempBit: TBitmap;
begin
   PaintBox1.Canvas.Font := FontC;
   PaintBox1.Canvas.Brush.Color := clAqua;
   PaintBox1.Canvas.Brush.Style := bsSolid;
   PaintBox1.Canvas.Pen.Color := clFuchsia;
   PaintBox1.Canvas.Pen.Style := psDOT;
   PaintBox1.Canvas.Ellipse(10,15,190,50);
   PaintBox1.Canvas.Brush.Style := bsClear;
   space := SetTextCharacterExtra(PaintBox1.Canvas.Handle,4);
   {change the text spaceing for attention}
   PaintBox1.Canvas.TextOut(25, 18, 'IMPORTANT');
   SetTextCharacterExtra(PaintBox1.Canvas.Handle,space);
   PaintBox1.Canvas.Brush.Style := bsSolid;
   TempBit := TBitmap.Create;
   TempBit.LoadFromFile('E:\Compile\handPoint.bmp');
   TempBit.Transparent := True;
   PaintBox1.Canvas.Draw(200,20,TempBit);
   TempBit.Free;
{this will NOT be refreshed on the paintbox}
end;

end.

 - - - - - - --- - - - -
this may allow you to help the way your users see the text, and even and to the story with small bitmaps or backgrounds
0
 

Author Comment

by:perkley
ID: 6350198
Mannsoft I tried out your code, but when I tried to install it in delphi 5 pro, it gave me an error saying that the lines were to long.  I couldn't get it to work.

Slick812, I tried your code and it works pretty cool.  I think you should get the points.

I will wait to see what Mannsoft says though.
0
 
LVL 6

Expert Comment

by:MannSoft
ID: 6350730
Hmm I have used that component in Delphi 4 thru 6 and havent seen that error before.  I guess its possible I changed something recently that broke it in older versions.  The component I was imitating when I wrote it is on www.torry.net can called TConsole.  It was written by a Borland coder who works on Delphi so it's probably better than mine anyway :-)
0
 

Author Comment

by:perkley
ID: 6350744
Slick812, thanks for your help.
0
 
LVL 33

Expert Comment

by:Slick812
ID: 6350898
wow, 5 points, that's a dificult desision. . . LOL
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now