Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 59689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:02:41+00:00 2026-05-10T18:02:41+00:00

I use the MFC list control in report view with grid lines to display

  • 0

I use the MFC list control in report view with grid lines to display data in a vaguely spreadsheet manner.

Sometimes when the user scrolls vertically through the control, extra grid lines are drawn, which looks terrible.

This does not happen when the slider or the mousewheel are used to scroll, only when the little down arrow button at the bottom of the scroll control is used.

It seems that this occurs when the size of the list control window is not an exact even number of rows, so that a partial row is visible at the bottom.

If I adjust the size of the list control so that there is no partial rows visible, the problem is solved. However, it will appear when the program is run on another computer, presumably because the number of pixels occupied by a row changes.

I am assuming that it is an interaction between screen resolution, font size and ‘dialog units’.

I guess that I need to programmatically force the size of the control when it is created. But what size?

I have tried using the ApproximateViewRect() method but I cannot get it to work. Perhaps this method does not know about report view?

The other method, I suppose, would be to create my own specialization of CListCtrl and over-ride whatever method is doing the scrolling. This seems likely to be a lot of work.

This screenshot shows a closely related problem where the grid lines go missing

alt text

and here is one with the extra grid lines

alt text

The only difference between these two and between them and one which scrolls perfectly is a few pixels different in the vertical size of the control.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:02:41+00:00Added an answer on May 10, 2026 at 6:02 pm

    To fix this bug in the MFC List Control you need to specialize the control, over-ride the method wich responds to the scroll, and force it to redraw the list completely after it has done the scroll.

    interface header

    class cSmoothListControl : public CListCtrl { public:     DECLARE_MESSAGE_MAP()     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); }; 

    implementation:

    BEGIN_MESSAGE_MAP(cSmoothListControl, CListCtrl) ON_WM_VSCROLL() END_MESSAGE_MAP()  void cSmoothListControl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) {     // call base class method to do scroll     CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);      // force redraw to cover any mess that may be created     Invalidate();     UpdateWindow(); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 75k
  • Answers 75k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer why you need extend vector in this way? use standard… May 11, 2026 at 2:44 pm
  • added an answer You could probably do something to the extent of the… May 11, 2026 at 2:44 pm
  • added an answer I'd really have to see an explain plan to know… May 11, 2026 at 2:44 pm

Related Questions

If I were to want to create a nice looking widget to stay running
I have a substantial body of source code ( OOFILE ) which I'm finally
Imagine I want to create an application which is very similar to MS Word
c++ mfc if CHttpConnection::OpenRequest returns a null what can I use to get the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.