大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> 程序开发 -> OICQ中用户图标选择的实现

OICQ中用户图标选择的实现

时间: 2021-07-31 作者:daque

unit unit1;interfaceuses windows, messages, sysutils, classes, graphics, controls, forms, dialogs, stdctrls;type tform1 = class(tform)  list1: tcombobox;  button1: tbutton;  procedure button1click(sender: tobject);  procedure formcreate(sender: tobject);  procedure list1drawitem(control: twincontrol; index: integer;   rect: trect; state: townerdrawstate); private  { private declarations } public  { public declarations } end;var form1: tform1;implementation{$r *.dfm}procedure tform1.button1click(sender: tobject);         vars: string;beginrandomize;s:= inttostr(random(100));//last here!createdir(s);end;procedure tform1.formcreate(sender: tobject);varbit1,bit2,bit3,bit4,bit5,bit6: tbitmap;begin list1.style := csownerdrawvariable; list1.itemheight := 30; bit1 := tbitmap.create; bit1.loadfromfile('c:\program files\oicq\face\1-1.bmp'); bit2 := tbitmap.create; bit2.loadfromfile('c:\program files\oicq\face\2-1.bmp'); bit3 := tbitmap.create; bit3.loadfromfile('c:\program files\oicq\face\3-1.bmp'); bit4 := tbitmap.create; bit4.loadfromfile('c:\program files\oicq\face\4-1.bmp'); bit5 := tbitmap.create; bit5.loadfromfile('c:\program files\oicq\face\5-1.bmp'); bit6 := tbitmap.create; bit6.loadfromfile('c:\program files\oicq\face\6-1.bmp'); list1.items.addobject('图标1',bit1); list1.items.addobject('图标2',bit2); list1.items.addobject('图标3', bit3); list1.items.addobject('图标4', bit4); list1.items.addobject('图标5', bit5); list1.items.addobject('图标6', bit6); list1.itemindex :=0;end;procedure tform1.list1drawitem(control: twincontrol; index: integer; rect: trect; state: townerdrawstate);varbitmap: tbitmap;offset: integer;begin with(control as tcombobox).canvas do begin  fillrect(rect);  bitmap := tbitmap(list1.items.objects[index]);  //bitmap := tbitmap.create;  //imagelist1.getbitmap(index,bitmap);  if bitmap<> nil then  begin   brushcopy(bounds(rect.left+2,rect.top+2,bitmap.width,bitmap.height),bitmap,       bounds(0,0,bitmap.width,bitmap.height),clred);  offset := bitmap.width + 8;  textout(rect.left+offset,rect.top,list1.items[index]);  end; end;end;end.

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.