Re: Having trouble with pens and brushes




I am not sure I understand your problem completely. Based on my
understanding, you have modified the Scribble C# sample to draw some
customized graphics, such as rectangles, but you failed to show them out.

In your second reply, it seems that you have found that this problem has
something to do with UpdateAllViews method calling. Is your problem
resolved? If you still need help, please feel free to tell me.

Based on my review, it seems you drawed the rectangles in the OnMouseUp
method, this may be the problem. If you draw in this method, the next
WM_PAINT message will invoke PaintHandler again, which erases your
previous
rectangle drawing, so you will not see the rectangle. To draw somthing on
the form, you should place the drawing logic in the PaintHandler, which
will be invoked whenever drawing is needed. In OnMouseUp method, we can
store the mouse up point in a variable, which can be used in PaintHandler
method.

Hope this helps!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.


Thanks for your replies.
I was trying to reproduce a problem I'm having in a different project. All
I needed to see was the rectangles get drawn; I did it in OnMouseButtonUp so
I wouldn't have to keep the rectangles around to draw in response to
WM_PAIINT. Since UpdateAllViews() didn't have code to draw the rectangles,
they were getting cleared but not re-drawn.
I understand what was going on, and don't need any more help with this.
Thanks again.


.


Loading