Hi all,
I have created my own "arrow" control where the user can drag the head
or tail around to reposition it, much like any vector-based line that
has an arrow head. It draws over top of other controls like any
vector graphic should but it has some problems.. In order to get as
far as I've gotten, I've 1) made the control transparent using
CreateParams.ExStyle |= WS_EX_TRANSPARENT (got this as a sample; it
was the only way it would work correctly for what I'm doing) 2)
overridden OnPaintBackground() and commented out the base class call,
and 3) made the control's Size the same size as its container, so that
the user could drag it anywhere around the container. Two things are
bad about this design (okay, maybe more that you can point out): the
control is as big as the container, which means no other control gets
mouse events and second, moving the arrow makes it flicker.
I think I can solve the first problem using regions, yes? Would it be
a good idea to restrict the size to one that is just big enough to be
a bounding rectangle for the arrow (which would require me to change
that size whenever the length/angle of the arrow changes)? Or should
I keep the size the same as the container's and just create a region
that is identical to the contour of the arrow?
As for the flicker problem, it seems to require my own double
buffering (I couldn't get ControlStyles.DoubleBuffer to work for me
but maybe I'm doing it wrong.) In order to do that, it seems that I
need to ask the container to repaint itself to a buffer that belongs
to the arrow control (it would need to repaint itself, and all its
controls, save the one that I'll repaint myself). If I'm not
mistaken, I can't simply do a capture of the container because I'll
end up capturing the the arrow in the process, which has not yet been
repositioned. But how do you tell a control (i.e. the container) to
repaint, not to the screen, but to a buffer? Am I barking up the
wrong tree on this one?
Thanks for any help. Please follow up--my email has been
"spamproofed".
Craig