Click to See Complete Forum and Search --> : lsitview with autosize
cpix
April 28th, 2008, 04:45 AM
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
foamy
April 28th, 2008, 05:07 AM
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 :)
somu0915
April 28th, 2008, 08:14 AM
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..
int colLength = 500;
listview1.Columns.Add(L"Column Name", colLength);
cpix
April 30th, 2008, 04:34 AM
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);
=======
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.