Hi there,
I've built a new component based on TCheckListBox.
Implemented a property 'CheckBox' which displays/hides the CheckBox area. All works fine but when current item changes (that is, ItemIndex changes) a FocusRect corresponding to the CheckBox area still visible for all non-current rows. Any way to invalide only this region?
Here's my code within DrawItem protected procedure:
---------------------------------------------------
Procedure TMyList.DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
RectText: TRect;
begin
if not bCheckBox then
begin
CopyRect(RectText, Rect);
RectText.Left := RectText.Left - 15;
inherited DrawItem(Index, Rect, State);
with Canvas do
begin
FillRect(RectText);
TextOut(RectText.Left+2, RectText.Top, Items[Index]);
if Index = ItemIndex then
begin
DrawFocusRect(Rect);
DrawFocusRect(RectText);
end
else
begin
// Problem's here...
//DrawFocusRect(Rect);
//DrawFocusRect(RectCheck);
end;
end;
end;
end;
---------------------------------------------------
Any ideas ???
Thanks in advance...
I've built a new component based on TCheckListBox.
Implemented a property 'CheckBox' which displays/hides the CheckBox area. All works fine but when current item changes (that is, ItemIndex changes) a FocusRect corresponding to the CheckBox area still visible for all non-current rows. Any way to invalide only this region?
Here's my code within DrawItem protected procedure:
---------------------------------------------------
Procedure TMyList.DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
RectText: TRect;
begin
if not bCheckBox then
begin
CopyRect(RectText, Rect);
RectText.Left := RectText.Left - 15;
inherited DrawItem(Index, Rect, State);
with Canvas do
begin
FillRect(RectText);
TextOut(RectText.Left+2, RectText.Top, Items[Index]);
if Index = ItemIndex then
begin
DrawFocusRect(Rect);
DrawFocusRect(RectText);
end
else
begin
// Problem's here...
//DrawFocusRect(Rect);
//DrawFocusRect(RectCheck);
end;
end;
end;
end;
---------------------------------------------------
Any ideas ???
Thanks in advance...