我将ListBox的MultiSelect设置为False,那么ListBox.SelCount的结果怎么是-1,如果MultiSelect为True就得到了正确的结果。
帮助原文如下:
Read SelCount to determine the number of items that are currently selected. If the value of the MultiSelect property is false, SelCount is 0 or 1. If MultiSelect is true, the value of SelCount can be greater than 1 as well.
帮助原文如下:
Read SelCount to determine the number of items that are currently selected. If the value of the MultiSelect property is false, SelCount is 0 or 1. If MultiSelect is true, the value of SelCount can be greater than 1 as well.
解决方案 »
- 如何避免API HOOK造成的程序崩溃
- 怎么让edit undo
- 問一個好基礎的問題,關於繼承的
- 如何使用fastreport自动换行,左右对齐的问题!
- CreateRemoteThread函数的使用问题?
- 64位windows 2008,64位oracle g11及64位客户端 oracleOLEDB报错
- delphi中如何调用DLL,谢谢回复
- 如何把CreatOleObject产生的变量删除?
- 如何将dbmemo中的数据导出到word文件中?
- 我的Delphi6,为什么在DEBUG的时候,我把鼠标放在变量上,DELPHI不会显示变量的值了?以前还好好的
- 如何使计算过的float数据四舍五入保留小数点后两位?
- 如何让TreeView的每个节点保存一个字符串?
Read SelCount to determine the number of items that are currently selected. If the value of the MultiSelect property is false, SelCount is 0 or 1. If MultiSelect is true, the value of SelCount can be greater than 1 as well.
//////////////
应该是BUG
begin
Result := SendMessage(Handle, LB_GETSELCOUNT, 0, 0);
end;
//////////////
调用这一句有问题..
见VCL Reference:
Description SelCount is read-only. Use SelCount to find the number of selected items in the list box when the MultiSelect property is true.When the MultiSelect property is false, SelCount is always -1.
wParam = 0; // not used; must be zero
lParam = 0; // not used; must be zero ParametersThis message has no parameters. Return ValuesThe return value is the count of selected items in the list box. If the list box is a single-selection list box, the return value is LB_ERR.
在Delphi 7.01的帮助中已经没有你说的那段话。