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

  • SEARCH
  • Home
  • 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

Related Questions

My application used to use an MFC CEdit control and we had no problems
The MFC combobox is really a wierd design. I use drop list type combo
Previously, I used to use MFC collection classes such CArray and CMap . After
I want to use Python to access MFC document files generically? Can CArchive be
I am building an MFC C++ application with Use Unicode Character Set selected in
I have a MFC dialog based application in which I use ::system() function to
I am working on threading in MFC..I am not sure how to use threading..
Does any body know how can I use MS_MPI in my VC++ MFC project?
Here's the regular expression I use, and I parse it using CAtlRegExp of MFC
OK, so we're writing our MFC application to make use of the built-in localization

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.