qq列人头像那种效果的combolistbox怎么作?

birdhzx 2003-10-19 06:13:48
在一个combolistbox里绘出某个目录下的所有图片,就象qq列人头像那种效果.
谁有demo,或者给点提示,image好像只能显示一幅图片.不知道该用什么图控件?
...全文
65 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
birdhzx 2003-10-20
  • 打赏
  • 举报
回复
收到,我自己调通了出问题的代码,(不过还不能显示jpeg,可以显示bmp了)
剑神一笑 ^_^:
呢的代码我以后试,(任务紧最近),多谢了.
delphipan 2003-10-20
  • 打赏
  • 举报
回复
收藏
hmzgz81 2003-10-20
  • 打赏
  • 举报
回复
up
pingshx 2003-10-20
  • 打赏
  • 举报
回复
1stclass
dickeybird888 2003-10-20
  • 打赏
  • 举报
回复
1, ComboBox.style := csOwnerDrawFixed;
2。ComboBox1.ItemHeight = 32;
3。ComboBox1.DropDownCount = 2;
在Form上放一个TImageList,把它的Height属性设为32,然后随便加几个OICQ的bmp文件;

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;
moeryang 2003-10-20
  • 打赏
  • 举报
回复
用控件吧mxoutlookbarpro
delphi盒子有下
sixgj 2003-10-19
  • 打赏
  • 举报
回复
不错。收藏再说。
pankun 2003-10-19
  • 打赏
  • 举报
回复
对了,记得在ImaegList里面加上32*32的BMP图片.
pankun 2003-10-19
  • 打赏
  • 举报
回复
在FORM上放一个ImageList,将高和宽设为32
再放一个TComboBox,将Style设为csOwnerDrawVariable

再加上如下代码就可以了
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
tmp: TBitmap;
begin
Tmp := TBitmap.Create;
ImageList1.GetBitmap(Index, Tmp);
TComBobox(Control).Canvas.Draw(Rect.Left, Rect.Top, Tmp);
Tmp.free;
end;

procedure TForm1.ComboBox1MeasureItem(Control: TWinControl; Index: Integer;
var Height: Integer);
begin
Height := 32;
end;
birdhzx 2003-10-19
  • 打赏
  • 举报
回复
我发现我这个人就是动手能力太差,是不是懒阿,
我基本上是这么写的,但是有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;


//图象列表
//FindFiles(sPath:string;var FileBuf:TStringList;var fileCount:integer); //返回目录下所有文件名 ,数目
FindFiles( CurrentExam.ImagePath,FileBuf,ImageNum);

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]; //图像的提示性文字是该图像的文件名

MyImage.Filename:=MyImage.Hint;

SPos := scbImageList.VertScrollBar.ScrollPos;
MyImage.TOP := (j - 1) * 75+25*j -sPos;;
//MyImage.TOP := (j - 1) * 100 + 5*j -sPos;;
MyImage.Left := 10;
MyImage.Height := 75;
MyImage.Width := 100;
MyImage.Stretch := true;

MyImage.Filename:=MyImage.Hint;
// MyImage.GetFirstFrame;

MyImage.ShowHint := true;
MyImage.OnClick := OnImgClick; {---加图象到报表中---}
j:= j + 1;

end;

MyImage.Free;
pankun 2003-10-19
  • 打赏
  • 举报
回复
自己自理重绘事件就可以了..
DELPHI中好像有例子吧...

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧