Little bit of test-code that seems to be doing what I want it to.
Starts by creating a collection of the class written at the bottom of the
file, which contains a SolidBrush, Rectangle and a Boolean.
MouseDown and MouseUp are handled and their click-coordinates stored, and
then checks are made against each shape in the collection in turn to see
if the click has fallen within the bounds of any of them. If the click was
within the bounds of a shape, it changes colour. If a shape is clicked a
second time, a third colour is used, showing that the shape is "off" now,
but was "on" at some time in the past.
It's all very quick-and-dirty, hurts my eyes after a few minutes, and it
only works for Rectangles at the moment, but it does what I need at a
level where Button objects just won't cut it.
Another question, though:
Can I get the Graphics object to not actually refresh until *after* it has
added all the Rectangles? At the moment it seems to be wasting a lot of
time on refreshing when each component is added, which is fairly
unneccessary.
All going well so far, thanks for the help.
KF
On Wed, 06 Sep 2006 00:24:49 +0100, Steven Nagy <le*********@hotmail.com>
wrote:
Its not dead while you still believe...
>Yes, that was pretty much what I was thinking I'd have to do. Shame the
Shape object is dead, really.
Anyway, its going to be the same result in the end. Just a different
implementation.
Create yourself a shapecontrol class that inherits from UserControl and
add some key properties for defining the clickable boundaries and the
drawing details. I never knew older non-OO versions of VB so I don't
know what the exact nature of your old shape objects were. But I bet
you can still simulate it. Once you do, let me know... I'd like to see
it in action.
--
Using Opera's revolutionary e-mail client:
http://www.opera.com/mail/