如何讓listbox中某一行隱藏?
或者讓某一行不能選中。
或者讓某一行不能選中。
解决方案 »
- 偶尔看到一则对联,大家鉴赏一下
- indy控件启动服务器时出现异常,加急,各位帮忙,散分50
- 急急急!Dephi中Tedit和Tcombox组件!在线问题不断………………
- 寻找一个控件????????
- 我写了个妇女计划生育的管理系统,有点问题,就是怎么判断该妇女结婚一周年、二周年?
- 如何设置,使得程序窗口随显示器不同而自动变化
- 如何定义和使用动态创建控件的事件?
- VB中有对图片的微彩处理,delphi如何实现?比如一个比较暗的黑白图片,用某种颜色做个底,微彩处理?
- 在C/S结构中,客户端如何以最好快的速度读和存取服务端的数据?
- 不明这两句应放在何种情形下,个人感觉两句效果一样,请详解。
- 如何把Form作为Array的元素,在程序中访问再Show??
- 过完年想去北京,这段时间该学些什么,大家帮我参考一下吧(想哭,真的好想哭,极度茫然中。。。)
for i:=0 to listbox1.items.count-1 do
if not listbox1.selected[你不想选中的那项] then//当选中的不是你希望不能选中的那项则做以下工作
begin
if listbox1.selected[i] then
.
.
.
end
else
showmessage('此项不能操作!');
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
S:string;
begin
s:=(Control as TListbox).Items[Index];
ListBox1.Canvas.FillRect(RECT);
DrawText((Control as TListbox).Canvas.Handle,
pchar(s),
Length(s),
Rect,
DT_Left OR DT_SingleLine);
if NeedHide=Index then
ListBox1.Canvas.FillRect(RECT);//覆盖掉这一行
end;
procedure TForm1.ListBox1MeasureItem(Control: TWinControl; Index: Integer;
var Height: Integer);
begin
height:=200;//控制行高
end;
2。
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
//其中控制隐藏,就象楼上老兄说的
end;
3。看看你的可用分
例如:让第i行不被选中if Listbox1.ItemIndex=i-1 then Listbox1.Selected[i-1]:=false;
begin
if listbox1.ItemIndex=i-1 then Listbox1.selected[i-1]:=false;
end;end.