掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
リスト項目の独自描画が何故か時間が掛かる (ID:39807)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
ループやFileListBoxを使わないようにすればいけるかな s1,s3の式は適当なので仕様に合わせてください。 procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var i,i1:integer; s1,s3 : string; begin ListBox1.Canvas.Brush.Color := clwindow; ListBox1.Canvas.FillRect(rect); ListBox1.Canvas.Font.Color := clwindowtext; ListBox1.Canvas.TextOut(rect.Left + 12, rect.Top, ListBox1.Items[index]); if odSelected in State then begin ListBox1.Canvas.Brush.Color := clyellow; ListBox1.Canvas.Font.Color := clwindowtext; ListBox1.Canvas.FillRect(rect); ListBox1.Canvas.TextOut(rect.Left + 12, rect.Top, ListBox1.Items[index]); end; s1 := ListBox1.Items[Index] + '.txt'; // fileelistbox1のフォルダや拡張子を s3 := ListBox1.Items[Index] + '.dat'; // fileelistbox3のフォルダや拡張子を if FileExists(s1) then begin ListBox1.Canvas.Brush.Color := clred; ListBox1.Canvas.Ellipse(rect.Left + 2, rect.Top + 2, rect.Left + 10, rect.Top + 10); end; if FileExists(s3) then begin ListBox1.Canvas.Brush.Color := clblue; ListBox1.Canvas.Ellipse(rect.Left + 2, rect.Top + 10, rect.Left + 10, rect.Top + 20); end; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.