I see a potential problem here, this above code does not say when at
what point does the event get called? After reviewing the events that
are available to you (TDBGrid), it is my best guess that this event
above only gets called after the mouse is released and not when it is
pushed down.
How ever, a simple test can determine this, if you press and hold the
mouse key down and see your little button drawn, then you are in luck :)
You can stash the RECT value away and process the WM_KEYUP message in
the form that contains this DBgrid.. When you process this message,
check to see if the stashed RECT is valid? IN other words, its not set
to a 0 value, if so then process the graphics code needed to undo the
button box and then clear the RECT value. You could also test for the
currently active control while there to save time.
You cold also simply assign a Button over that area and then process
the DB code yourself in the button event. Set your own image on the
button. They're a few ways :)
Jamie