DrawCell Event

Fired when the OwnerDraw property is set to allow custom cell drawing.

Syntax

Private Sub VSFlexGrid_DrawCell( ByVal hDC As Long,  ByVal Row As Long,  ByVal Col As Long,  ByVal Left As Long,  ByVal Top As Long,  ByVal Right As Long,  ByVal Bottom As Long, Done As Boolean)

Remarks

This event is fired if the OwnerDraw property is set to a non-zero value, to allow for custom painting on selected cells.

The parameters for the DrawCell event are described below:

hDC As Long

This parameter contains a handle to the control's device context. The hDC parameter is required by all Windows GDI calls.

Row, Col As Long

These parameters define the cell that is about to be drawn.

Left, Top, Right, Bottom As Long

These parameters define the rectangle that contains the cell. The coordinates are given in pixels, so they can be used directly in the GDI calls.

Done As Boolean

This parameter should be set to True to indicate that the event did, in fact, handle the drawing. Set it to False to indicate that you don't want to paint this particular cell and the control should handle it instead.

Note

Owner-drawn cells are a fairly advanced feature that requires knowledge of the Windows GDI calls. If you decide to use this feature, our technical support technicians will probably not be able to help you with problems you may encounter. Efficient painting is also fundamental to the perceived speed of your application, so use this feature only if you really need it, and make sure your own painting code is as fast as possible.

The distribution CD includes sample projects that show how you can use OwnerDraw property both in Visual Basic and in Visual C++. Look for the OwnerDraw and PropPage demos.

See Also

VSFlexGrid Control