Форум: "Потрепаться";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];
ВнизКак сделать недоступными некоторые items в TListBox? Или есть другой компонент с такой фичей? Найти похожие ветки
← →
MBo (2002-03-21 16:02) [4]style OwnerDraw поставь
procedure TForm1.Button1Click(Sender: TObject);
var i:Integer;
begin
for i:=0 to 9 do
LB1.Items.AddObject("String"+IntToStr(i),pointer(odd(i)));
// если уже заполнен, делай
// LB1.Items.Objects[i]:=pointer(enabled);
// где enabled- boolean или Integer
end;
procedure TForm1.LB1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
with LB1.Canvas do begin
FillRect(Rect);
if Boolean(LB1.Items.Objects[Index]) then
Font.Color:=clLtGray
else Font.Color:=clBlack;
TextOut(Rect.Left,Rect.Top,LB1.Items[Index]);
Font.Color:=clBlack;
end;
end;
procedure TForm1.LB1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
APoint: TPoint;
Index: Integer;
begin
if Button = mbLeft then begin
APoint.X := X;
APoint.Y := Y;
Index := LB1.ItemAtPos(APoint, True);
if (Index>=0) and (not Boolean(LB1.Items.Objects[Index])) then
label1.caption:=LB1.Items[Index];
end;
end;
Страницы: 1 вся ветка
Форум: "Потрепаться";
Текущий архив: 2002.04.29;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.005 c