ListView with first column exceeding limit

0

Hello! I made a form using the MaterialSkin library

In this library there is a component called ListView (which would be similar to the ListView of WinForms) that the first column is buggy. Look at this image:

Correct would be to get all three dots just like in the CPF-CNPJ column, however, the first column overlaps all the others when it has many characters. Does anyone know what the solution might be?

Edit 1: Preferably a form other than simply giving a substring in the characters of the first column !!

Edit 2: I'm filling in the table with the following code:

fornecedores = new Fornecedor().retornaItens(tbFiltro.Text,30);
lstFornecedores.Items.Clear();

    foreach (Fornecedor fornecedor in fornecedores)
    {
        var item = new ListViewItem(new string[ {fornecedor.nome,fornecedor.cpfcnpj,fornecedor.tipoPessoa.ToString(),fornecedor.endereco});
            lstFornecedores.Items.Add(item);
    }
    
asked by anonymous 11.01.2018 / 16:56

2 answers

0

I was able to solve it! Since the fault was only in the first column, I created a first column with a width of 0 and filled it with an empty string. So it cuts automatically :)

fornecedores=newFornecedor().retornaItens(tbFiltro.Text,30);lstFornecedores.Items.Clear();foreach(Fornecedorfornecedorinfornecedores){varitem=newListViewItem(newstring[]{"",fornecedor.nome,fornecedor.cpfcnpj,fornecedor.tipoPessoa.ToString(),fornecedor.endereco});
            lstFornecedores.Items.Add(item);
        }
    
17.01.2018 / 16:24
0

Well come on, there are 3 types of Auto Sizing column: ColumnHeaderAutoResizeStyle.None , ColumnHeaderAutoResizeStyle.HeaderSize and the ColumnHeaderAutoResizeStyle.ColumnContent .

To set the column [0] in the list, just change the property SuaLista.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.None);

If you want to increase the width of the column, simply change the property SuaLista.Columns[1].Width = 150; or higher, by default the value is 60 width.

Follow the example below:

    
14.01.2018 / 01:57