CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2001
    Location
    Czech Republic
    Posts
    78

    Question DashStyle pattern gets corrupted when scrolling

    Hi,

    in my VS 2010/.NET 4.0 application I am drawing a sort of focus rectangle using ControlPaint.DrawBorder with the ButtonBorderStyle.Dotted flag. However, I noticed that when only part of the control that contains the focus rectangle is invalidated and repainted, the dash pattern of the bottom line looks incorrect. Instead of regular dots it shows dots and dashes of variable length.
    I tested this behavior with a simple line and a pen with the dotted style. The problem occurs when the line is drawn "right to left" instead of "left to right". I assume it has something to do with the DashOffset property of the pen and the clipping rectangle.

    My question is, should I draw the focus rectangle myself using DrawLine (and using only "left to right" coordinates) or is there a more elegant solution?

    The attached picture shows the right side of the control which has been dragged out of the screen and then slowly back. The top line was drawn "left to right", the bottom one "right to left".
    Attached Images Attached Images  

Tags for this Thread

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