procedure TASManForm.ListBox_ASDrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
{
Zeichnen eines Items
}
var
ASStruc: TTC7AutoStartStruc;
ASPointer: PTC7AutoStartStruc;
FileIcon: TBitmap;
Text1, Text2, Text3:
string;
//für die dreizeilige Ausgabe
TextRect: TRect;
begin
ASPointer := AutoStarts.Items[
Index];
ASStruc := ASPointer^;
with (Control
as TCheckListBox)
do begin
Canvas.Brush.Color := clWhite;
Canvas.FillRect(Rect);
TextRect := Rect;
TextRect.Left := Rect.Left + 50;
case ASStruc.AutoStartDangerLevel
of
dlLow: Canvas.Brush.Color := Color_ASMan_DangerLow;
dlMiddle: Canvas.Brush.Color := Color_ASMan_DangerMiddle;
dlHigh: Canvas.Brush.Color := Color_ASMan_DangerHigh;
end;
Canvas.FillRect(TextRect);
FileIcon := TBitmap.Create;
case ASStruc.EntryType
of
asBinaryFile, asTextFile:
begin
if FileExists(ASStruc.FileData.FileName)
then begin
FileIcon := ConvertIconToBmp(GetIconFromFile(ASStruc.FileData.FileName, 0));
end else begin
FileIcon := BmpFromIcoFile(AppDir + Icon_ASMan_FileNotFound);
end;
Text1 := ExtractFileName(ASSTruc.FileData.FileName);
Text2 := format(_asmanListTextFilePath, [IncludeTrailingPathDelimiter(ExtractFilePath(ASSTruc.FileData.FileName))]);
Text3 := '
';
if ASStruc.EntryType = asBinaryFile
then begin
Text3 := _asmanListTextIsBinary;
end else begin
Text3 := format(_asmanListTextLineCount, [FormatThousands(ASSTruc.FileData.FileTextLineCount)]);
end;
Text3 := Text3 + '
, ' + format(_asmanListTextSize, [FormatThousands(ASStruc.FileData.FileSize)]);
if ASStruc.FileData.FileAttr
and faHidden > 0
then begin
Text3 := Text3 + '
, ' + _asmanListTextHidden;
end;
end;
asRegistryKey:
begin
FileIcon := BmpFromIcoFile(AppDir + Icon_ASMan_Reg);
end;
asRegistryValue:
begin
if ASStruc.RegData.ResultFile<>'
'
then begin
FileIcon := ConvertIconToBmp(GetIconFromFile(ASStruc.RegData.ResultFile, 0));
end else begin
FileIcon := BmpFromIcoFile(AppDir + Icon_ASMan_Reg);
end;
Text1 := ASStruc.RegData.Key;
Text2 := format(_asmanListTextRegPfad, [ASStruc.RegData.MainKey, ASStruc.RegData.Path]);
Text3 := format(_asmanListTextRegValue, [ASStruc.RegData.Value]);
end;
end;
//case ASStruc.EntryType of
//todo: nur für Debugzwecke!!!!
Text3 := Text3 + '
(' + ASStruc.UniqueID + '
)';
Canvas.Draw(Rect.Left + 10, Rect.Top + 11, FileIcon);
Canvas.Font.Color := clBlack;
Canvas.Font.Size := 8;
Canvas.Font.Style := [fsBold];
Canvas.TextOut(Rect.Left + 55, Rect.Top + 7, Text1);
Canvas.Font.Color :=
RGB($33, $33, $33);
Canvas.Font.Size := 7;
Canvas.Font.Style := [];
Canvas.TextOut(Rect.Left + 65, Rect.Top + 26, Text2);
Canvas.Font.Size := 7;
Canvas.Font.Style := [];
Canvas.TextOut(Rect.Left + 65, Rect.Top + 41, Text3);
end;
end;