drawing snap mode indicator

S

Sam

Hi guys

I'm writing a small drawing program which has "snap to grid" mode and I
want to display something (some kind of shapes for example a small square or
circle which indicate the current snap point of my mouse) but I have no
success so far. I tried controlpain.drawreversibleframe method to draw a
tiny square to indicate my current snap point of my mouse as it moves on my
grid points; and this somwhat gives me what I want. The problem with this
method is that everytime I call invalidate method of my picturebox(my
drawing surface), there will be one extra square drawn by
drawingreversibleframe method. This solution is even worse when it comes to
resizing form because the controlpaint method has no restriction within my
drawing surface.

Does anyone have any other ideas to implement this? In VB6 I used a shape
control and set its background to transparent property and this gave me what
I want. I was thinking to use a drawing square method of GDI+ to implement
this or a small label to serve as an indicator but then I have to call my
control's invalidate method to redraw everything as my mouse moves but this
is not efficient way to do.

Regards,

Sam
 
K

Ken Tucker [MVP]

Hi,

Check out Carl Franklins SelectForm.Zip example.

http://www.franklins.net/dotnet/

Ken
--------------------
Hi guys

I'm writing a small drawing program which has "snap to grid" mode and I
want to display something (some kind of shapes for example a small square or
circle which indicate the current snap point of my mouse) but I have no
success so far. I tried controlpain.drawreversibleframe method to draw a
tiny square to indicate my current snap point of my mouse as it moves on my
grid points; and this somwhat gives me what I want. The problem with this
method is that everytime I call invalidate method of my picturebox(my
drawing surface), there will be one extra square drawn by
drawingreversibleframe method. This solution is even worse when it comes to
resizing form because the controlpaint method has no restriction within my
drawing surface.

Does anyone have any other ideas to implement this? In VB6 I used a shape
control and set its background to transparent property and this gave me what
I want. I was thinking to use a drawing square method of GDI+ to implement
this or a small label to serve as an indicator but then I have to call my
control's invalidate method to redraw everything as my mouse moves but this
is not efficient way to do.

Regards,

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top