掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
フォルダからMP3ファイルを検索してListBox1に表示するには? (ID:8366)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
>Items[i]:=inttostr(i)+Items[i]とかじゃ無理でしょうね >やってないんじゃないですか? はぁ?Item[i]に直接番号追加したら永久ループして 最悪はオーバーフローするでしょ? ちょっとは考えてからアドバイスしてあげたらどうですか? TFileListBoxがTCustomListBoxからの派生クラスのため OnDrawItemが使えないか試してみましたが TFileListBox内ですでにOnDrawItemを使用しているせいか 描画処理を奪えませんでした。 ソースをお持ちであればTFileListBoxを参考にTCustomListBoxから 派生させて作成するぐらいしかないようです。 uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, FileCtrl; type TFileListBoxEx = class(TFileListBox) private { Private 宣言 } procedure OnDrawItemEventEx(Control: TWinControl; Index: Integer;Rect: TRect; State: TOwnerDrawState); public { Public 宣言 } constructor Create(AOwner: TComponent); override; end; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private 宣言 } FFileListBoxEx : TFileListBoxEx; public { Public 宣言 } end; var Form1: TForm1; implementation {$R *.DFM} { TFileListBoxEx } constructor TFileListBoxEx.Create(AOwner: TComponent); begin inherited; OnDrawItem := OnDrawItemEventEx; Style := lbOwnerDrawVariable; end; procedure TFileListBoxEx.OnDrawItemEventEx(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); begin // 64ドット右に移動させようとしたけど処理がここには来ない Canvas.TextOut(Rect.Left + 64, Rect.Top, (Control as TListBox).Items[Index]) end; procedure TForm1.FormCreate(Sender: TObject); begin FFileListBoxEx := TFileListBoxEx.Create(Self); FFileListBoxEx.Parent := Self; FFileListBoxEx.Align := alClient; end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.