|
-
Oct 7th, 2010, 09:58 AM
#13
Re: Painting issue, when to draw/erase snap lines
 Originally Posted by boops boops
I'm impressed by how the app is structured -- small files, little routines sometimes with just 1 line of code but always with 4 lines of documentation, all fitting neatly together. Is that a Csharp thing? Or is it good design practice anyway?
It's just good design practice I suppose. I try to keep as much code in separate methods so that each method has only the relevant code. The only place where I haven't done that yet is in the shape moving/resizing and snapping, because that's the area I'm working on now. It was very neat before, but then I introduced multiple selections and it all became rather messy. Still have to refactor that.
 Originally Posted by SJWhiteley
I'm not sure if this is relevant to this issue, but drawing rectangles and filling rectanges actually covers 2 different areas - that is, a drawn rectangle is 1 pixel wider and taller than the fill region. so, that may account for the fact that the bottom-right lines show and the top-left ones don't?
(I'm currently working on my own designer, and haven't implemented snapping to lines, but have implemented aligning multiple selected shapes, grab handles)
The snap lines are just that: lines. I have a class SnapLine with a Draw method, but all it does is draw the line using Graphics.DrawLine. Nothing special going on there. The lines are drawn correctly, and in the correct spot. They just are removed from the collection right afterwards and the canvas is invalidated a second time, so they disappear again. If I use Refresh instead of Invalidate, then I can see them flickering. By debugging I've determined that the lines are drawn, and then the entire 'line drawing method' is run a second time, this time with the lines collection empty (so they are removed again). I just can't figure out why it's being called again. This seems easy to debug but it's not because it is called when I move a shape, and I cannot move a shape and be in the debugger at the same time
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|