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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:18:14+00:00 2026-06-03T13:18:14+00:00

I have a ListView in which i want to create an event when the

  • 0

I have a ListView in which i want to create an event when the VScrollBar appears. I actully dont want a horizontal scrollbar and whenever the VScrollbar appears i want to resize the columns so that it fits the window. I already can check for the visiblity of a scrollbar but i dont know the name of the event which is triggered when the ScrollBars appear.
Here is my code :

    private const int WS_VSCROLL = 0x200000;
    private const int GWL_STYLE = -16;
    [DllImport("user32.dll")]
    public static extern int GetWindowLong(IntPtr hWnd, int Index);
    private static bool IsScrollbarVisible(IntPtr hWnd)
    {
        bool bVisible = false;
        int nMessage = WS_VSCROLL;
        int nStyle = GetWindowLong(hWnd, GWL_STYLE);
        bVisible = ((nStyle & nMessage) != 0);
        return bVisible;
    }

And Works Like this :

    if (IsScrollbarVisible(listview.Handle))
    {
          columnHeader1.Width = listview.ClientRectangle.Width - (columnHeader2.Width + columnHeader3.Width);
    }

Someone Please Help Me!

  • 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-03T13:18:15+00:00Added an answer on June 3, 2026 at 1:18 pm

    ClientSizeChanged Event will fire but to get it work correct we have to add BeginUpdate() and EndUpdate()..

    This Code does everything :

        private void listview_ClientSizeChanged(object sender, EventArgs e)
        {
            listview.BeginUpdate();
            if (IsScrollbarVisible(listview.Handle))
            {
                columnHeader1.Width = listview.ClientRectangle.Width - (columnHeader2.Width + columnHeader3.Width);
            }
            listview.EndUpdate();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a listview type user control which'll have a picturebox and
I have an Application in which first I want to create a backup of
I want to create a layout which contains TextView , Button and ListView here
I want to create a single choice listview in which when an item is
i want to create an activity, in which, i would like to have a
I have created a dynamic listview which contains a CheckBox.what I want is at
I have ListView which is saving all data to database. For adding i have
I have a ListView which is using a GridView to display a DataTable and
I have a listview which has its datasource changed after update of a search
I have a ListView which contains custom rows. This custom row has following UI

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.