Subject Custom drawing in a CtrlGrid (e.g. EMF from BLOB)
Author mircostange
Hi Everyone,

I am trying to display a list of EMF graphics from a query in a
CtrlGrid. I had a version with BMPs, but they look ugly, so I try to
rework the code here.

As I understand, TIB_Image cannot display EMFs (what a pitty) so I
have to do the drawing on my own. Drawing EMFs in general works fine,
that is not the issue here. I can also load them from the BLOB field
into some TMetaFile variable.

The question is: where do I put the drawing code - and moreover, the
resize code?

Drawing is supposed to happen on a TImage's canvas which I dropped
into the CtrlGrid. I found the OnPaintPanel event which is supposed
to give me the current row number, so I can load the right EMF BLOB.
However, I tried to save the row number as a panel caption (also in
the grid) and it shows wrong numbers. Having 3 EMFs, the method is
called with 3-2-3.

I tried some other attributes (query.bufferRowNum, query.rownum)
without success.

Furthermore, I'd like redraw the metafile when the grid is resized. I
can catch some resize event and do the redraw, but the question here
is again: data from which row?

Can anyone help?

Mirco