Re: Having trouble with pens and brushes



Hi Schemer,

Thanks for your post!

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.

.



Relevant Pages

  • Re: How to draw to the screen not the form?
    ... For drawing the rectangles, you need to look at some of the usual ... In other words, use the XORPEN flag to draw it, then draw it again ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Having trouble with pens and brushes
    ... it seems you drawed the rectangles in the OnMouseUp ... If you draw in this method, ... WM_PAINT message will invoke PaintHandler again, ... rectangle drawing, so you will not see the rectangle. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: CView and bitmap problem
    ... Please do not immediately dismiss this as a "put drawing code ... My drawing of rectangles and lines, and arcs, and all ... I can even draw bitmaps. ... However, when a window ocludes the bitmap, it is not refreshed, even ...
    (microsoft.public.vc.mfc)
  • Re: DirectDraw line drawing? Filled rectangles using xor,or,and ops?
    ... > Is it possible to draw lines using DirectDraw, ... is it possible fill rectangles using ... DirectDraw does not offer any line drawing facilities (although you can ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: Drawing on DC
    ... class Circle: public Drawing { ... It would be *called* from OnDraw, ... You should only draw when you need to draw, ... Drawing your objects on a bitmap merely renders the circle, rectangle, etc. as bits (which ...
    (microsoft.public.vc.mfc)