procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
ComboBox1.Canvas.Brush.Color := clWindow;
if odSelected in State then ComboBox1.Canvas.Brush.Color := clHighLight;
ComboBox1.Canvas.FillRect(Rect);
ImageList1.Draw(ComboBox1.Canvas, Rect.Left, Rect.Top, Index);
end;
procedure TForm1.ComboBox1DropDown(Sender: TObject);
begin
if ComboBox1.Items.Count <> ImageList1.Count then
ComboBox1.Items.Text := StringOfChar(#13, ImageList1.Count);
end;
我发现我这个人就是动手能力太差,是不是懒阿,
我基本上是这么写的,但是有n多bug,我想看看你们的,.比较快,这也是csdn论坛火热的原因把,
谢谢
procedure TFrmPrint.UpdateImageList;
var
MyImage:TAllImage;
MyLabel:TLabel;
SPos,i, j:integer;
NumOfDICOMFrame:integer;
begin
for i := scbImageList.ComponentCount - 1 downto 0 do
scbImageList.Components[i].free;
if ImageNum=0 then
begin
exit;//没有图象的情况
pictureNum:=1;
end;
ImageNum:=fileCount;//图象数目
j:=1;
for i := 1 to (ImageNum) do
begin
//为图像预留空间
MyImage := TAllImage.Create(scbImageList);
MyImage.Parent := scbImageList;
imgPath:=FileBuf[i];
if imgPath[length(imgPath)]<>'\' then
imgPath:=imgPath+'\'; //得到图像路径
MyImage.Hint := FileBuf[i]; //图像的提示性文字是该图像的文件名