کامپوننت ListView دارای خاصیت Wrap
با سلام به همه
آیا به غیر از کامپوننت های معروفی مثل تلریک و غیره، کامپوننت ListView وجود دارد که بتوان برای ردیف ها خاصیت Wrap تعریف کرد تا اگر دیتایی زیاد بود با حالت Wrap همه رو نشون بده.
ممنون میشم اگه راهنمایی بکنید تا اگر کامپوننتی دارید در دسترس قرار بدید تا بتوانم ازش استفاده کنم.
نقل قول: کامپوننت ListView دارای خاصیت Wrap
مگه خود listview حالت wrap نداره؟؟
نقل قول: کامپوننت ListView دارای خاصیت Wrap
خیر متاسفانه. لااقل من در property ها ندیدم. اگر این قابلیت داره راهنمایی کنید.
ممنون
نقل قول: کامپوننت ListView دارای خاصیت Wrap
یکی از کامپوننت ها، objectlistview هست که میتونید استفاده کنید
نقل قول: کامپوننت ListView دارای خاصیت Wrap
متاسفانه اینم که اضافه کردم و توی فرمم گذاشتم، حتی با اینکه هنوز کدی هم نوشته نشده و فقط این آبجکت رو در فرم گذاشتم برنامه که اجرا میشه خطا میده. برنامه هم به دات نت 4 تغییر دادم ولی باز هم خطا داد.:ناراحت::افسرده:
نقل قول: کامپوننت ListView دارای خاصیت Wrap
نقل قول: کامپوننت ListView دارای خاصیت Wrap
خطاش مربوط به ورژن دات نت فریم ورک هست. باید ورژهای پایین تر از 4 رو انتخاب کنم، که من برنامم جوریه که نمی تونم با دات نت کمتر از نسخه 4 کار کنم.:افسرده:
راه حل دیگه ای ممکنه باشه؟
نقل قول: کامپوننت ListView دارای خاصیت Wrap
http://www.componentowl.com/document...ulti-line.html
(یک کامپوننت دیگه)
اگه کار نکرد؛
این رو توی stack overflow پیدا کردم:
class WordWrapListView : ListView
{
private const int LVM_FIRST = 0x1000;
private const int LVM_INSERTITEMA = (WordWrapListView.LVM_FIRST + 7);
private const int LVM_INSERTITEMW = (WordWrapListView.LVM_FIRST + 77);
private Graphics graphics;
public WordWrapListView()
{
this.graphics = this.CreateGraphics();
base.View = View.Details;
this.AutoSizeRowHeight = true;
}
//overriding WndProc because there are no item added events
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
// Detect item insert and adjust the row size if necessary based on the text
// add in LVM_DELETEITEM and LVM_DELETEALLITEMS and reset this.rowHeight if you want to reduce the row height on remove
case WordWrapListView.LVM_INSERTITEMA:
case WordWrapListView.LVM_INSERTITEMW:
{
ListViewItem lvi = this.Items[this.Items.Count - 1];
for (int i = 0; i< lvi.SubItems.Count; ++i)
{
ListViewItem.ListViewSubItem lvsi = lvi.SubItems[i];
string text = lvsi.Text;
int tmpHeight = 0;
int maxWidth = this.Columns[i].Width;
SizeF stringSize = this.graphics.MeasureString(text, this.Font);
if (stringSize.Width > 0)
{
tmpHeight = (int)Math.Ceiling((stringSize.Width / maxWidth) * stringSize.Height);
if (tmpHeight > this.rowHeight)
{
this.RowHeight = tmpHeight;
}
}
}
}
break;
default:
break;
}
base.WndProc(ref m);
}
private void updateRowHeight()
{
//small image list hack
ImageList imgList = new ImageList();
imgList.ImageSize = new Size(this.rowHeight, this.rowHeight);
this.SmallImageList = imgList;
}
[System.ComponentModel.DefaultValue(true)]
public bool AutoSizeRowHeight { get; set; }
private int rowHeight;
public int RowHeight
{
get
{
return this.rowHeight;
}
private set
{
//Remove value > this.rowHeight if you ever want to scale down the height on remove item
if (value > this.rowHeight && this.AutoSizeRowHeight)
{
this.rowHeight = value;
this.updateRowHeight();
}
}
}
// only allow details view
[Browsable(false), Bindable(false), DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), EditorBrowsable(EditorBrowsableState.Never)]
public new View View
{
get
{
return base.View;
}
set
{
}
}
}
ببینید کار میکنه؟
نقل قول: کامپوننت ListView دارای خاصیت Wrap
با سلام و سپاس.
متاسفانه این کامپوننت هم نسخه trial هست و هر بار که برنامه اجرا میشه، یک صفحه اول برنامه میاد که باید خریداری بشه و یک کلید Continue داره که اونم وقتی زده بشه با حالت Trial میاد بالا.