CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    SetScrollSizes blink

    Hi!!
    I´m using SetScrollSizes to set the bars of a CScroolView Window. I only know the document size after the very first time I print it (on OnDraw). So I´m declaring a flag that sinalizes if it is the very first time the document is being printed, if so I call SetScroolSizes. The problem is that when SetScroolSizes is called the bars appear ok but the window blink, and then it blink again to show the document. How to avoid this first blink?

    Thank you in advance.

  2. #2
    Join Date
    Aug 1999
    Location
    Germany
    Posts
    2,338

    Re: SetScrollSizes blink

    Try setting the scroll-sizes in OnSize.

  3. #3
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    Re: SetScrollSizes blink

    That is the problem, on OnSize I don´t have the document sizes yet. I have the sizes only after the first draw. I compute the size doing:
    Code:
    CMyScrollView::OnDraw(CDC* pDC)
    {
      ...
      if(Extremex < pDC->GetTextExtent(strLinhaAtual.c_str()).cx)
        Extremex = pDC->GetTextExtent(strLinhaAtual.c_str()).cx;
      Extremey = ++NLines * CharSize.cy; 
      ...
    }
    strLinhaAtual.c_str() has the line being printed.
    Extreme(x and y) will have the doc size at when all lines are printed.

    Thank you

  4. #4
    Join Date
    Aug 1999
    Location
    Germany
    Posts
    2,338

    Re: SetScrollSizes blink

    In OnSize, you can create a CDC like this:

    CWindowDC dc(this);
    if(Extremex < dc.GetTextExtent(strLinhaAtual.c_str()).cx)
    ....

    Does this help?

  5. #5
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    Re: SetScrollSizes blink

    Yes, but I´ll need to read all document at first time without print it just to get its extents. I would like to avoid this step. I would like to try another solution (if it exists).

    Thank you

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