Board index » delphi » How to Colour a Specific Grid Cell?

How to Colour a Specific Grid Cell?

Hi

   I am writing a program that uses the TStringGrid component,
   but am finding it slighly limited in what I want it to look
   like

   How can (1) I change the colour of a specific cell.
           (2) I change the border width of a specific cell
     and finally
           (3) I create a drop down list in one cell to only
                 allow selection from that list.

eg..

    ------------------------------------
    | Heading ....                     |
    -------------------------------------
    | Blue Cell | Green Cell | White Cell|
    --------------------------------------
    |Drop Down Box | cell || Another cell|
        Option 1          ^^
        Option 2           thicker cell width..
        Option 3

  This is just a smaple of what I need.. I have the layout and stuff
   under control, its just the 3 points above that I cannot achieve

Any help would be appreciated.

Thanks in advance

Cheers
Andrew

--
_______________________________________________________________________
Andrew Myers <a...@tml.co.za>   [Web Admin - Times Media Limited (TML)]
                                [Sys Admin - Wits Medical Library     ]

 WWW : http://www.pipex-sa.net/~andrew          TEL : +2711 280 - 3944
   HOME SMAIL : P.O.Box 8029, Edenglen, 1613, Gauteng, South Africa
             OTHER : finger and...@ka.pipex-sa.net
_______________________________________________________________________

 

Re:How to Colour a Specific Grid Cell?


Hi

   I am writing a program that uses the TStringGrid component,
   but am finding it slighly limited in what I want it to look
   like

   How can (1) I change the colour of a specific cell.
           (2) I change the border width of a specific cell
     and finally
           (3) I create a drop down list in one cell to only
                 allow selection from that list.

eg..

    ------------------------------------
    | Heading ....                     |
    -------------------------------------
    | Blue Cell | Green Cell | White Cell|
    --------------------------------------
    |Drop Down Box | cell || Another cell|
        Option 1          ^^
        Option 2           thicker cell width..
        Option 3

  This is just a smaple of what I need.. I have the layout and stuff
   under control, its just the 3 points above that I cannot achieve

Any help would be appreciated.

Thanks in advance

Cheers
Andrew

--
_______________________________________________________________________
Andrew Myers <a...@tml.co.za>   [Web Admin - Times Media Limited (TML)]
                                [Sys Admin - Wits Medical Library     ]

 WWW : http://www.pipex-sa.net/~andrew          TEL : +2711 280 - 3944
   HOME SMAIL : P.O.Box 8029, Edenglen, 1613, Gauteng, South Africa
             OTHER : finger and...@ka.pipex-sa.net
_______________________________________________________________________

You could change DefaultDrawing property to False and draw things
yourself using OnDrawCell. But then you would lose a lot of the
drawing that TStringGrid does for you already.

Instead, just keep DefaultDrawing set to True and then write code for
the OnDrawCell. For any cells that are DIFFERENT than your default,
simply redraw them (you may need to clear the cell rectangle first to
get rid of the default drawing in that cell).

Mark_Radcli...@msn.com

Other Threads