Re: Pen problem (bug?) when using ScaleTransform.

From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 07/16/04


Date: Fri, 16 Jul 2004 17:18:11 +0200

Is the pen width really 1 pixel or 1 page unit?

If you want a 1pixel pen, not a 1/2 pixel pen you can use a pen-width of -1
or scale the pen to the inverse of the drawing scale.

-- 
Bob Powell [MVP]
Visual C#, System.Drawing
The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
"Peter Erikson" <PeterErikson@discussions.microsoft.com> wrote in message
news:CAEBA6EC-C172-4674-BA6B-7E88E5F75051@microsoft.com...
> Hi,
>
> I have a problem drawing lines (with the Pen object) on a derived Panel
when I scale the graphics object in OnPaint. It only happens when i scale
down (or zoom out).
>
> e.Graphics.ScaleTranstorm(0.5F, 0.5F); // for example
>
> The problem is that sometimes when a line is drawn on or very close to the
cliprectangles edge (but still within the cliprectangle) the line won´t show
up. This behaviour is somewhat iregular tho.
>
> If I for instance draw a an rectangle with an outline/border and the Pen
with is 1 pixel. And I invalidate a recttangle with its edge very close to
the rectangles edge the outline of the rectangle won´t show up. Even thoug
the rectangle is drawn.
>
> This only seems to happen with lines (graphic object drawn with Pen).
>
> Has someone else experienced this?
>
> /Peter


Relevant Pages

  • Re: Cant get zooming into a selected area to work correctly.
    ... The idea being that the mouse is dragged over an area and the area within the selection rectangle is scaled and then centred to fit in the scrollpane. ... The point passed to that method specifies what point of the contained view will be in the upper-left corner of the viewport, ... It's not just some random method that's used to set the scale for the view. ... private BufferedImage _image; ...
    (comp.lang.java.programmer)
  • Re: Locating An Image At Arbitrary Scales, Translations, and Rotations
    ... at an arbitrary scale, translation, and rotation. ... If your object really is just a rectangle, it's easy enough to find its ...
    (sci.image.processing)
  • Re: Pen problem (bug?) when using ScaleTransform.
    ... Yes the pen width is one pixel. ... it is still hamppening tho. ... > or scale the pen to the inverse of the drawing scale. ... > the rectangles edge the outline of the rectangle won´t show up. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Scaling font sizes with MM_LOMETRIC
    ... and then blit this to the view to the scale you want. ... > zoomed text I multiply the font size by the zoom level (e. ... > a rectangle around a text so that the text perfectly fits into ...
    (microsoft.public.vc.mfc)
  • Re: How to print what I have drawn in OnDraw
    ... I have to scale the distance in OnDraw. ... calculate the scale between screen rectangle and ...
    (microsoft.public.vc.mfc)