?
Solved

different colours of Stringgrid cells

Posted on 1999-01-14
3
Medium Priority
?
318 Views
Last Modified: 2010-04-06
how can i give the choice cells of a stringgrid different
textcolours or background colours ?
0
Comment
Question by:tzigan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1356564
Hmm. I don't know. Have you looked for extended freeware components?

http://nswt.tuwien.ac.at/delphi/index.htm    (Delphi Super Page)
http://www.torry.ru/       (Torry's Delphi Pages)

Regards, Madshi.
0
 
LVL 3

Accepted Solution

by:
Ronald Buster earned 400 total points
ID: 1356565
Hi TZigan,

This is simple just write your own OnDrawCell procedure place a stringgrid on your form
choose events and double click on OnDrawCell event now place for instance following
code :

procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Integer;
  Rect: TRect; State: TGridDrawState);
var tr : TRect;
     ts : string;
     te : extended;
begin
   tr := StringGrid1.CellRect(Col, Row);
   if Odd(Row) then
     begin
        with StringGrid1.Canvas do
           begin
              Brush.Color := clBtnFace;
              Font.Color := clNavy;
              Font.Style := [fsBold];
              FillRect(tr);
             TextOut(tr.Left+2, tr.Top+2, StringGrid1.Cells[Col,Row])
          end;
      end
   else
      begin
        with StringGrid1.Canvas do
           begin
              Brush.Color := clBlue;
              Font.Color := clWhite;
              Font.Style := [fsItalic];
              FillRect(tr);
             TextOut(tr.Left+2, tr.Top+2, StringGrid1.Cells[Col,Row])
          end;
      end;
end;


Hope this helps,

regards,

Cono
0
 

Author Comment

by:tzigan
ID: 1356566
Test was great - thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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