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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:43:01+00:00 2026-05-10T15:43:01+00:00

I have a little problem with a Listview. I can load it with listview

  • 0

I have a little problem with a Listview.

I can load it with listview items fine, but when I set the background color it doesn’t draw the color all the way to the left side of the row [The listViewItems are loaded with ListViewSubItems to make a grid view, only the first column shows the error]. There is a a narrow strip that doesn’t paint. The width of that strip is approximately the same as a row header would be if I had a row header.

If you have a thought on what can be done to make the background draw I’d love to hear it.

Now just to try a new idea, I’m offering a ten vote bounty for the first solution that still has me using this awful construct of a mess of a pseudo grid view. [I love legacy code.]

Edit:

Here is a sample that exhibits the problem.

public partial class Form1 : Form {     public Form1()     {         InitializeComponent();          ListView lv = new ListView();          lv.Dock = System.Windows.Forms.DockStyle.Fill;         lv.FullRowSelect = true;         lv.GridLines = true;         lv.HideSelection = false;         lv.Location = new System.Drawing.Point(0, 0);         lv.TabIndex = 0;         lv.View = System.Windows.Forms.View.Details;         lv.AllowColumnReorder = true;          this.Controls.Add(lv);          lv.MultiSelect = true;          ColumnHeader ch = new ColumnHeader();         ch.Name = 'Foo';         ch.Text = 'Foo';         ch.Width = 40;         ch.TextAlign = HorizontalAlignment.Left;          lv.Columns.Add(ch);          ColumnHeader ch2 = new ColumnHeader();         ch.Name = 'Bar';         ch.Text = 'Bar';         ch.Width = 40;         ch.TextAlign = HorizontalAlignment.Left;          lv.Columns.Add(ch2);          lv.BeginUpdate();          for (int i = 0; i < 3; i++)         {               ListViewItem lvi = new ListViewItem('1', '2');              lvi.BackColor = Color.Black;             lvi.ForeColor = Color.White;              lv.Items.Add(lvi);         }         lv.EndUpdate();     } } 
  • 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-10T15:43:02+00:00Added an answer on May 10, 2026 at 3:43 pm

    Ah! I see now :}

    You want hacky? I present unto you the following:

        ...     lv.OwnerDraw = true;     lv.DrawItem += new DrawListViewItemEventHandler( lv_DrawItem );     ...  void lv_DrawItem( object sender, DrawListViewItemEventArgs e ) {     Rectangle foo = e.Bounds;     foo.Offset( -10, 0 );     e.Graphics.FillRectangle( new SolidBrush( e.Item.BackColor ), foo );     e.DrawDefault = true; } 

    For a more inventive – and no less hacky – approach, you could try utilising the background image of the ListView 😉

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

Sidebar

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • 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 Unfortunately, this is not possible with the default Django template… May 11, 2026 at 12:33 pm
  • added an answer Absolutely - but you'll have to edit the project file… May 11, 2026 at 12:33 pm
  • added an answer Put your code inside a <asp:PlaceHolder runat='server'> tag. There was… May 11, 2026 at 12:33 pm

Related Questions

I have a problem with a little .Net web application which uses the Amazon
I've run on a little problem today: I have a JS drop down menu
I have a little Java problem I want to translate to Python. Therefor I
I’m having a little Architecture problem. In my project I have a Business Logic
I wrote a django app, but I have a little problem with the file
I have a little math problem. I would like to have a function with
Does anyone know if it possible to define the equivalent of a java custom

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.