Re: Grid cell draw

From: AlanGLLoyd (alanglloyd_at_aol.com)
Date: 11/04/04


Date: 04 Nov 2004 08:29:54 GMT

In article <a8274029.0411032203.559dbaec@posting.google.com>,
prasad.kulkarni@mailcity.com (Prasad Kulkarni) writes:

>After setting
>the text in this manner. I also want to auto fit the column width. We
>can calculate the largest width in the column during the
>CustomDrawCell, but when to adjust the width for the column,

You don't know either the order nor the occasions when OnDrawCell is called.

So you would be better doing the cell width adjustment outside the OnDrawCell.
Do it when you load the stringgrid with text (measuring the widths of all
Strings in every TStringGrid.Cols and doing one change, calling
LockWindowUpdate(MyStringgrid.Handle) before setting all the columns and
LockWidowUpdate(0) after, to prevent an immediate redraw on every setting
change. Also (if you allow editing of cells) call the column width setting for
the edited column in OnSetEditText.

Alan Lloyd
alanglloyd@aol.com



Relevant Pages

  • Re: countif multiple conditions
    ... if your sheet names or cell locations are different, ... location they don't adjust. ... John word ... Ann excel ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Auto Row Height in Merged Cells with pre exisiting text
    ... The cell range is A50:AA142 ... Dim CurrentRowHeight As Single, MergedCellRgWidth As Single ... This says to not adjust the rowheight if the current row height is larger than ...
    (microsoft.public.excel.programming)
  • Ping D. Peterson.. for follow-up
    ... In cell D4, is the place to place the tabs name, and then in cells ... the size of the page will adjust ... the print area still goes all the way out 52 columns(where ...
    (microsoft.public.excel.worksheet.functions)
  • Re: need to have SUM formula update on row add/delete/move - Excel 2003
    ... And it would adjust when you inserted a new cell/row. ... If I insert a new row above 21, 99.9% of the time, I want the SUM to ... another cell. ... I have taken to inserting a tiny row just above the row containing the ...
    (microsoft.public.excel)
  • Re: Wordwrap
    ... If the text in a cell is too long to display in the cell, and the WordWrap ... Have to use the hidden textbox to adjust the row height on ... the flexgrid. ...
    (comp.lang.basic.visual.misc)