qq列人头像那种效果的combolistbox怎么作? 在一个combolistbox里绘出某个目录下的所有图片,就象qq列人头像那种效果.谁有demo,或者给点提示,image好像只能显示一幅图片.不知道该用什么图控件? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己自理重绘事件就可以了..DELPHI中好像有例子吧... 我发现我这个人就是动手能力太差,是不是懒阿,我基本上是这么写的,但是有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; 在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; 对了,记得在ImaegList里面加上32*32的BMP图片. 收到,我自己调通了出问题的代码,(不过还不能显示jpeg,可以显示bmp了)剑神一笑 ^_^:呢的代码我以后试,(任务紧最近),多谢了. 用控件吧mxoutlookbarprodelphi盒子有下 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; 这种格式怎么实现! Delphi7调用.net的webservice 传进去的参数为空 Delphi串口实时采集 高手请进,cxGrid1想增加一列来显示倒计时 delphi 终止sql查询 有谁用过FlyTreeViewPro这个控件啊,怎么用啊 》》》》如何实现通过SERVERSOCKET 在对客户端接受到的数据之后,立即进行发送数据。。 托盘程序问题 有关声明的一些问题 急!急!急!急! .dcu是什么文件?有方法查看它的源代码吗? delphi求助!
DELPHI中好像有例子吧...
我基本上是这么写的,但是有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;
再放一个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;
剑神一笑 ^_^:
呢的代码我以后试,(任务紧最近),多谢了.
delphi盒子有下
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;