簡體   English   中英

使用C#增加ListView中子項目的字符數限制

[英]increasing character limit of subitem in listview with C#

我想知道是否有可能增加listview的子項文本的字符數限制。限制為259個字符。任何想法都將不勝感激。

問候,

這里有一些建議。 不幸的是,有一個不能超過的限制。

http://social.msdn.microsoft.com/Forums/en/csharplanguage/thread/aad539a5-1b9f-4880-8b8e-59d4630706ab

1)您可以嘗試使用子項來包裝文本。 項目限制為259個字符,因此將對象分成多個項目。

2)唯一可能的解決方案是使用您自己的或模仿ListView但不是從ListView派生的第三方組件。

這也許可以幫助您:

.NET ListView,最大字符數或最大列寬? 可以覆蓋/擴展嗎?

以下是專門幫助您創建自己的列表視圖的代碼:

public class MyListView : ListView
{
    public MyListView()
    {
        OwnerDraw = true;
        DrawItem += new DrawListViewItemEventHandler(MyListView_DrawItem);
    }

    private void MyListView_DrawItem(object sender, DrawListViewItemEventArgs e)
    {
        e.Graphics.DrawString(e.Item.Text, e.Item.Font, 
                                    new SolidBrush(e.Item.ForeColor), e.Bounds);
    }
}

只需檢查objectlistview是否支持此功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM