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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:06:28+00:00 2026-06-13T15:06:28+00:00

I have my own ListView class, inheriting from Forms.ListView. When double clicking on the

  • 0

I have my own ListView class, inheriting from Forms.ListView. When double clicking on the line between the columns, the columns resize to show the column items in full size.

HOWEVER, for me this doesnt work properly – some words are partially hidden.

My theory is that this is due to the items having different fonts and that the ListView doesnt look at them all, causing some larger font items to still be partially hidden.

Anyone got a solution to this problem (I cant seem find any event for when double clicking between columns)? And is my theory plausible?

best regards

  • 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-13T15:06:30+00:00Added an answer on June 13, 2026 at 3:06 pm

    I think you could try with this code, I wrote it now, tested and it worked for me. Note that on my computer ColumnwidthChanging event is firing on each pixel changed (when you resize column using mouse) and on double click it changes for more than two pixels.Iam passing Font that is set for the list. You should do it with the font for particular ListViewItem. Try it out and if it works for you than that’s it.

            private void listView1_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
            {
                ListView lv = (ListView)sender;
                int widthDifference = Math.Abs(lv.Columns[ e.ColumnIndex].Width - e.NewWidth);
                if( widthDifference>2)
                {
                    int maxWidth = 0;
                    Graphics g = lv.CreateGraphics();
                    for(int i = 0;i<lv.Items.Count;i++) 
                    {
                        string text = string.Empty;
                        if (e.ColumnIndex == 0)
                        {
                            text = lv.Items[i].Text;
                        }
                        else
                        {
                            text = lv.Items[i].SubItems[e.ColumnIndex - 1].Text;
                        }
                        SizeF sizeF = g.MeasureString(text, lv.Font);
                        if (maxWidth < (int)(sizeF.Width + 0.5))
                            maxWidth = (int)(sizeF.Width + 0.5);
                    }
                    g.Dispose();
                    e.NewWidth = maxWidth;
                }
            }
    

    EDIT:These are the settings for my ListView in Form1.Designer.cs, I think this can help you:

     this.listView1.FullRowSelect = true;
     this.listView1.GridLines = true;
     this.listView1.Location = new System.Drawing.Point(253, 160);
     this.listView1.Name = "listView1";
     this.listView1.Size = new System.Drawing.Size(428, 97);
     this.listView1.TabIndex = 9;
     this.listView1.UseCompatibleStateImageBehavior = false;
     this.listView1.View = System.Windows.Forms.View.Details;
     this.listView1.ColumnWidthChanging += new System.Windows.Forms.ColumnWidthChangingEventHandler(this.listView1_ColumnWidthChanging);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build my own listView with selectedItem and Itemsource. I have started
I have a ListView (with an Adapter of my own) where I'd like to
I have own project and i would like add for this class same as
I'm trying to hide window after its startup. I have own window-class which is
I have created a custom list view and created my own adapter class I
I have 2 custom ListView Created as item layout + ArrayAdapter + My own
I've created a listview with its own adapter, but now I have to implement
I have an arraylist which contain objects of my own class. I want to
I have a ListView where I want to display items from more than one
I have two columns in my listView, lets call them Column1, and Column2. Is

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.