I have set 'goColSizing' of TStringGrid to true. When I move the mouse
pointer to the FixedRows, it allows me to resize the width of the column.
However, when I move to mouse pointer to the FixedCols (the area where the
FixedRows and FixedCols overlap), I cannot resize the width of this column.
So, how can I resize the width of the fixed column at run time?
Thanks.
--
Best regards,
Enoch Ng,
[snip]
>So, how can I resize the width of the fixed column at run time?
Have a look at ColWidths property of string grid.
StringGrid->ColWidths[which column] = <width in pixel>;
For example:
StringGrid->ColWidths[0] = 120;
Hope this helps
Ciao
Giuliano
The only way I've found is to set fixed cols to 0 and then simulate it
myself using owner draw.
You can draw the 0th col to always show the contents of the grid col 0
rather than the current (real) leftmost and can color the column grey in
the OnDrawCell handler. And you can ignore mouse clicks on it by using
the OnSelectCell event handler.
With this done, the columns can be resized. The only problem with that
may be that you will need to manage the actually column sizes very
carefully, since the user will be changing the width of the leftmost col
which won't always be col 0.
------
Mark Cashman (TeamB - C++ Builder), creator of The Temporal Doorway at
http://www.temporaldoorway.com
- Original digital art, writing, music and more -
C++ Builder / JBuilder Tips and The C++ Builder Programmer's Webring
(Join us!)
http://www.temporaldoorway.com/programming/index.htm
------
Thank you for the solution. I understand your method and it is what I need.
However I am afraid there are many things to be implemented if the grid
supports scrolling. The fixed column should be fixed when the user scroll
horizontally. When I scroll it, no OnDrawCell event on that virtual fixed
column will be triggled. So, the virtual fixed column will be replaced by
the next column and the virtual fixed column will disappeared. How can I
solve it?
Thanks.
"Mark Cashman" <mcas...@temporaldoorway.com> ?????
news:3A301CD9...@temporaldoorway.com...
This is the tricky part. You have to determine which column is the
leftmost and pretend it is col 0 in the OnDrawCell
if (ACol == TheGridInQuestion->LeftCol)
{
// This is the fake col 0, so draw in the Col 0 data, not the
real column data.
Does that make sense?
Enoch Ng wrote:
--
Yeh Lung-chuan(葉龍泉)
Jackie Yeh
Software engineer
Rayson Technology Co., Ltd.
jack...@ms7.url.com.tw
jack...@mail.rayson.com
O:+886-3-5633666-218
M:+886-930-051103
ICQ:17918151
I have tried your solution but I still have a problem. Let's say we have
100 Columns and 10 columns is currently displayed with 1 column is a fixed
column. When you click the right scroll button, only the
OnDrawCell() on next column has been triggered, that is, 11th column. The
first column (that fixed column) will be replaced by the second column
automatically by the TStringGrid. You have no way to refresh the OnDrawCell
on the fixed column. How can I solve this?
Thanks..
"Mark Cashman" <mcas...@temporaldoorway.com> ?????
news:3A357E21...@temporaldoorway.com...
I think you can draw the 3D effect on the DrawCell method yourselves.
"Jackie Yeh (葉龍泉)" <jack...@ms7.url.com.tw> ?????
news:3A3DEC37...@ms7.url.com.tw...
I thought I had answered this. Anyway, you have to be prepared to draw
the content of the 0th col into the leftmost visible col, no matter
which that is.