Re: lsitview with autosize
Just to be clear, you want the listview to automatically adjust its width to show a string in its entire length rather than showing a horizontal scrollbar?
EDIT: Seems I confused the ListView with the ListBox ... well, it happens :)
Re: lsitview with autosize
Quote:
Originally Posted by cpix
Hi! I've seen very few exampels on sizing the listview columns. While im adding file and dir paths to it, it automaticly gets cropped, which is kind of anoying. I dont know WHY ms diddnt included a option for length and dif length from row to row, but is there an easy way to solve this problem? I found one example in c++ and it diddnt make much sense to me.
Any suggeston or help is very much appriciated.
-pix
You can always add a length to the column of a listview..
Code:
int colLength = 500;
listview1.Columns.Add(L"Column Name", colLength);
Re: lsitview with autosize
seems i was bit unclear :) The problem im having is that I got a listview
which is getting files and folder paths. Problem is, when i Drop a item to the listview the string gets cropped like this somefi~1.txt, it's not the listview that makes this problem, seems more like the drag from the folderview control (tested with others as well), so there must be some the way i retrive the data from the control im dragging from..
private void ListView1_ItemDrag_1(object sender, System.Windows.Forms.ItemDragEventArgs e)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
private void ListView1_DragEnter_1(object sender,
System.Windows.Forms.DragEventArgs e)
{
e.Effect = DragDropEffects.Copy;
}
and then finally:
===========
FileName = ((string[])(e.Data.GetData("FileName")))[0];
lbltest.Text = FileName;
lvBackupFiles.Items.Add(FileName);
=======