StringGrid

J

jodleren

Hi all

There is no such thing as a StringGrid in the component overview, or
did I miss it?
Is there something similar?

Or should I create my own?
The advantage for my tester would be, that I have have a red/green
field for OK/NOK and eventually other symbols as well as different
fonts/colors/etc. I am not sure how to do that yet, Suggestions
welcome ;)

WBR
Sonnich
 
J

jodleren

For those of us who don't have a Delphi background, perhaps you could
first explain what a "StringGrid" is, because asking whether there's
something similar.

Right :)

A StringGrid is just like a databasegrid, with a number of rows/
coloumns, including "fixed" rows/coloumns (for use as e.g. headers).
One can set it such as:

MyGrid.Rows = 3;
MyGrid.Cols = 3;
MyGrid.FixedRows = 1;
MyGrid.Cells[0, 0] = "Corner";
MyGrid.Cells[0, 1] = "Headertext";
MyGrid.Cells[1, 1] = "data 1"; // forgive me if I mixed x/y
MyGrid.Cells[2, 1] = "data 2";
MyGrid.RowHeight = 17;
MyGrid.CellWidths[0] = 100;
MyGrid.CellWidths[1] = 200;

The Delphi version does not offer fonts/colours, but they can be
applied on the OnPaint event ( Canvas.TextOut(x, y, text...); )

There is a nice picture here:
http://www.asiplease.net/computing/delphi/string_grid_component.htm

The first thing I do is to change the height from 24 pixels to 17,
which is standard for the DB Grid.
I'd like some texts, and in a Delphi case I'd add to the OnDrawCell /
Paint event:

Canvas.Font.Bold = true;
Canvas.TextOut(x, y, "Active step"

and

Canvas.Pen.BGColor = "Red or green";
Canvas.Font.Color = maybe white is good
Canvas.FillRect // make it look like a button, clear to the user what
status is
Canvas.TextOut(x, y, "OK or NOK"

WBR
Sonnich
 
J

jodleren

A StringGrid is just like a databasegrid, with a number of rows/
coloumns, including "fixed" rows/coloumns (for use as e.g. headers).

What's a "databasegrid"?

Looks a lot like the System.Windows.Forms.DataGridView control.

Yes, and I even found something about it:

http://bytes.com/topic/c-sharp/answers/251986-simple-home-made-stringgrid

Next, I'd like to change the "painting" of the items as on OnDrawCell.
And get rid of the pointer to the left.
And for future options - can I mark the entire row, with no option for
editing?

Sonnich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top