CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    [RESOLVED] Graphic bug

    When I use this line to draw lines on a picture:

    Code:
    Dim MyPen as new Pen with {.width=1}
    Dim MyGraphics As Graphics = Graphics.FromImage(BMP)
    MyGraphics.DrawLines(MyPen, MyDots.ToArray)
    I get this image:


    but if I use MyPen.Width = 2, then I get the right image:



    I don't understand what I are doing wrong.
    [Vb.NET 2008 (ex Express)]

  2. #2
    Join Date
    Feb 2000
    Location
    OH - USA
    Posts
    1,892

    Arrow Re: Graphic bug

    Could you post a sample project that we can use to reproduce the error?
    Good Luck,
    Craig - CRG IT Solutions - Microsoft Gold Partner

    -My posts after 08/2015 = .NET 4.x and Visual Studio 2015
    -My posts after 11/2011 = .NET 4.x and Visual Studio 2012
    -My posts after 02/2010 = .NET 4.0 and Visual Studio 2010
    -My posts after 12/2007 = .NET 3.5 and Visual Studio 2008
    -My posts after 04/2007 = .NET 3.0 and Visual Studio 2005
    -My posts before 04/2007 = .NET 1.1/2.0

    *I do not follow all threads, so if you have a secondary question, message me.

  3. #3
    Join Date
    Jan 2010
    Posts
    1,133

    Re: Graphic bug

    Intriguing. It’s one of those problems that make no sense.

    Now, this is just guesswork, but try playing with the SmoothingMode, InterpolationMode, PixelOffsetMode, CompositingMode & CompositingQuality properties of the Graphics class.
    Is your image resized after you draw to it? This might be the cause.

  4. #4
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: Graphic bug

    Quote Originally Posted by Craig Gemmill View Post
    Could you post a sample project that we can use to reproduce the error?
    Ok. Graphic data is too large to enter on this post, so I attach a txt file with the code.

    map is drawed by double clicking the picturebox control

    each double click switches pen width
    Attached Files Attached Files
    Last edited by Marraco; January 11th, 2010 at 03:24 PM. Reason: Added attachment
    [Vb.NET 2008 (ex Express)]

  5. #5
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: Graphic bug

    Quote Originally Posted by TheGreatCthulhu View Post
    Intriguing. It’s one of those problems that make no sense.

    Now, this is just guesswork, but try playing with the SmoothingMode, InterpolationMode, PixelOffsetMode, CompositingMode & CompositingQuality properties of the Graphics class.
    Is your image resized after you draw to it? This might be the cause.
    Great!

    That was.

    Adding those lines:
    Code:
    MyGraphics.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
    MyGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
    solves it.

    Thanks TheGreatCthulhu

    Here is a bit of Latin rock for you!:
    http://www.youtube.com/watch?v=K_ZWc5nBWys
    [Vb.NET 2008 (ex Express)]

  6. #6
    Join Date
    Jan 2010
    Posts
    1,133

    Re: [RESOLVED] Graphic bug

    Thanks. Glad I was able to help.
    Last edited by TheGreatCthulhu; January 11th, 2010 at 05:08 PM. Reason: I wrote: Glad I was able help. :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured