2015-04-02 40 views
0

我有一個對話框和列表控件。
我添加使用insertitem列表控制一個巨大的字符串。爲什麼在mfc的listcontrol中插入文本顯示截斷文本? listcontrol是可調整的?

m_WSDLParamList.InsertItem(LVIF_TEXT | LVIF_PARAM, i, str, 0, 0, 0, NULL); 
// str is very huge. 

現在,我回來使用

CString str = m_WSDLParamList.GetItemText(5,0); 

(即無論我把我得到了它,因爲它是。)

字符串但是,在顯示我看到字符串截斷。這是爲什麼?

注意:我的對話框是可調整大小的,因此是listcontrol

代碼 -

mylist.EnableToolTips(TRUE); mylist.SetExtendedStyle(LVS_EX_INFOTIP | mylist.GetExtendedStyle()); mylist.InsertColumn(0,L「suri」,LVCFMT_LEFT,100);

CString str1 = L"nonNegativeInteger GetVehicleOwnerHolderByRegNumAndDateResponse.GetVehicleOwnerHolderByRegNumAndDateResult[optional].GetVehicleOwnerHolderByRegNumAndDateResultType.VHOwnerHolderResponse.VHOwnerHolderResponseType.Body.VehicleCountries.VehicleCountriesType.VehicleCountry[1, unbound].VehicleCountryType.VehCountryReplies.VehCountryRepliesType.VehCountryReply[1, unbound].Messages[optional].Message[1, unbound].MessageType.MessageCode"; 
for (int i = 0; i < 20 ; i++) { 
    mylist.InsertItem(LVIF_TEXT | LVIF_PARAM, i, str1, 0, 0, 0, NULL); 
} 

enter image description here

+0

請表明,定義了的CListCtrl的報頭控制的列中的代碼。 – rrirower 2015-04-02 13:09:11

+0

有些圖片會有所幫助。 – 2015-04-02 13:40:26

+1

因爲我想更多的信息,我嘗試猜測: 您在報告模式列表控制。您插入了一個寬度有限的列。因此,所有項目都被截斷爲列表控件中列的寬度。 – xMRi 2015-04-02 14:06:10

回答

1

使用LVM_SETCOLUMNWIDTH來定義你想要的寬度。

+0

我的列表框是自動resizebale列。如果我調整列寬度,仍然顯示trucation。我閱讀以下鏈接,發現它是mfc限制http://microsoft.public.vc.mfc.narkive.com/69A1zQtc/how-to-show-more-than-255-chars-as-item-in-clistctrl -urgent-plz – Suri 2015-04-04 07:22:17

+0

不,我不能同意這一點。該發佈是關於報告模式。據我看到你沒有啓用報告模式。 – xMRi 2015-04-05 18:05:44