CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Scrolling Help

  1. #1
    Join Date
    Apr 2001
    Posts
    75

    Scrolling Help


    Hi,

    I am a beginner. I am drawing a sound waveform in a CScrollview derived view.
    When I use the scroll bars, the drawing moves accordingly but in a persistent manner: All the previous plots stay on screen until their region gets invalidated.

    When the whole view is invalidated, the original waveform gets redrawned in the original position relative to the view (device coordinates). It seems not to have noticed the fact that the scrolling bars are not at the same place anymore.

    I have tried to use calls to OnPrepareDC and DPtoLP at various places in my code but until now nothing seems to change.

    Can anybody give me some hints ?

    Thank you very much



  2. #2
    Join Date
    Aug 2008
    Posts
    8

    Re: Scrolling Help

    Did you ever fix this? I have the same problem. I'm trying to draw rectangles that seem to draw on themselves again upon scrolling in either direction. Also, the rectangles are completely redrawn when I minimize then restore the window but apparently the origin moves.

    My code to draw the rectangles is

    CRect TempRect = pDoc->GetNode(i); // The points for the rectangle
    OnPrepareDC(pDC);
    pDC->DPtoLP(&TempRect);
    pDC->Rectangle(TempRect);

    and I set the scroll bars sizes in OnInitialUpdate with

    CSize Workspace(1000, 1000);
    SetScrollSizes(MM_LOENGLISH, Workspace);

    I have tried a variety of fixes in OnPrepareDC included setting the mapping mode to MM_LOENGLISH and setting the origin at 0, 0 but nothing works.

    Any help?

  3. #3
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Scrolling Help

    You should check out the DrawCLI sample in the MSDN samples.

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