ListBox - Color
1 отговора
46 прегледа
ListBox - Color
Mojete li da mi kajete ima li na4in na ocvetia Item na FileListBox.
Mnogo 6te sum vi blagodaren za vsiaka informacia.
Mnogo 6te sum vi blagodaren za vsiaka informacia.
Re: ListBox - Color
unit MyFileListBox;
interface
uses
SysUtils, Classes, Controls, StdCtrls, FileCtrl;
type
TMyFileListBox = class(TFileListBox)
private
{ Private declarations }
protected
procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);override;
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [MyFileListBox]);
end;
{ TMyFileListBox }
procedure TMyFileListBox.DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState);
begin
inherited;
if (odSelected in State) or (odFocused in State) then
begin
Self.Canvas.Brush.Color := $009CDEF7;
Self.Canvas.FillRect(Rect);
Self.Canvas.Font.Color := clBlack;
Self.Canvas.TextOut(Rect.Left + 3, Rect.Top + 1, Self.Items[Index]);
if odFocused in State then
begin
Self.Canvas.Brush.Color := clBlack;
Self.Canvas.FrameRect(Rect);
end;
if odSelected in State then
begin
Self.Canvas.Brush.Color := $009CDEF7;
Self.Canvas.FrameRect(Rect);
end;
end;
if (not (odSelected in State)) and (not (odFocused in State)) then
begin
Self.Canvas.Brush.Color := clWhite;
Self.Canvas.FillRect(Rect);
Self.Canvas.TextOut(Rect.Left + 3, Rect.Top + 1, Self.Items[Index]);
end;
end;
end.
interface
uses
SysUtils, Classes, Controls, StdCtrls, FileCtrl;
type
TMyFileListBox = class(TFileListBox)
private
{ Private declarations }
protected
procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);override;
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [MyFileListBox]);
end;
{ TMyFileListBox }
procedure TMyFileListBox.DrawItem(Index: Integer; Rect: TRect;
State: TOwnerDrawState);
begin
inherited;
if (odSelected in State) or (odFocused in State) then
begin
Self.Canvas.Brush.Color := $009CDEF7;
Self.Canvas.FillRect(Rect);
Self.Canvas.Font.Color := clBlack;
Self.Canvas.TextOut(Rect.Left + 3, Rect.Top + 1, Self.Items[Index]);
if odFocused in State then
begin
Self.Canvas.Brush.Color := clBlack;
Self.Canvas.FrameRect(Rect);
end;
if odSelected in State then
begin
Self.Canvas.Brush.Color := $009CDEF7;
Self.Canvas.FrameRect(Rect);
end;
end;
if (not (odSelected in State)) and (not (odFocused in State)) then
begin
Self.Canvas.Brush.Color := clWhite;
Self.Canvas.FillRect(Rect);
Self.Canvas.TextOut(Rect.Left + 3, Rect.Top + 1, Self.Items[Index]);
end;
end;
end.