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 8379561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:13:22+00:00 2026-06-09T16:13:22+00:00

I have a list view where I want to disable the horizontal scroll bar.

  • 0

I have a list view where I want to disable the horizontal scroll bar.

Basically, I know none of my data will exceed the width of the single column, but if enough entries get added to the list view, the vertical scroll bar pops up, reducing the width available, making the horizontal scroll bar pop up.

I was thinking about some how catching a message right before the vertical scroll bar gets added, and then re-sizing the column to make enough room, but I don’t know what message I would need to catch to do this.

EDIT:
Does anyone know if there is a message sent after an item in a list view is deleted? LVN_ITEMCHANGED appeared to only be sent after an item is added. And LVN_DELETEITEM only before an item is deleted.

  • 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. Editorial Team
    Editorial Team
    2026-06-09T16:13:24+00:00Added an answer on June 9, 2026 at 4:13 pm

    Well I worked out one solution.
    There is a bug though, if I only remove one item it doesn’t resize the column.

    case LVN_DELETEITEM:
    {
        LPNMLISTVIEW listView = (LPNMLISTVIEW) lParam;
    
        // After an item is deleted,
        // if there is not a vertical scroll bar and GWL_USERDATA is TRUE,
        // resize the column back to normal.
        if (!(GetWindowLong(listView->hdr.hwndFrom, GWL_STYLE) & WS_VSCROLL) &&
              GetWindowLong(listView->hdr.hwndFrom, GWL_USERDATA) == TRUE)
        {
            const int ColWidth = ListView_GetColumnWidth(listView->hdr.hwndFrom, 0);
            ListView_SetColumnWidth(listView->hdr.hwndFrom, 0, ColWidth + GetSystemMetrics(SM_CXVSCROLL));
            SetWindowLong(listView->hdr.hwndFrom, GWL_USERDATA, FALSE);
        }
    
        break;
    }
    
    case LVN_ITEMCHANGED:
    {
        LPNMLISTVIEW listView = (LPNMLISTVIEW) lParam;
    
        // After an item is added, if there is a horizontal scrollbar,
        // resize the column and set GWL_USERDATA to TRUE.
        if (GetWindowLong(listView->hdr.hwndFrom, GWL_STYLE) & WS_HSCROLL)
        {
            const int ColWidth = ListView_GetColumnWidth(listView->hdr.hwndFrom, 0);
            ListView_SetColumnWidth(listView->hdr.hwndFrom, 0, ColWidth - GetSystemMetrics(SM_CXVSCROLL));
            SetWindowLong(listView->hdr.hwndFrom, GWL_USERDATA, TRUE);
        }
    
        break;
    }
    

    I’d still love to see a better solution, but this works for now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list view with 10 columns and I want each row to
I have a list view and depending on some logic I want to temporary
Ho I have two list view on a frame layout. I want one overlay
I have a list of images in grid view.I want to display a gallery
I have a view with a name list. I want to jumble the list
I have a list view in which I am loading 10 items. I want
I have a list view that is displaying data using the gridview. This list
I have a list view and want each cell in my within it to
I have a list view with multi columns... Want to change the background color
I have a list view in which I show data. When I click on

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.