LoadIcon的用法!(5分)

  • 主题发起人 主题发起人 cdmwz
  • 开始时间 开始时间
C

cdmwz

Unregistered / Unconfirmed
GUEST, unregistred user!
API:LoadIcon函数可以帮助我们得到图标句柄,这些图标用IDI_APPLICATION、IDI_WINLOGO等表示,但是只能得到Windows预定义的图标,我们怎样使用自己的图标呢?<br>
 
procedure TFormMain.Timer1Timer(Sender: TObject);<br>begin<br>&nbsp; if Index=0 then<br>&nbsp; begin<br>&nbsp; &nbsp; Application.Icon.Handle:=LoadIcon(HInstance,'NEXT');<br>&nbsp; &nbsp; Index:=1;<br>&nbsp; end else<br>&nbsp; begin<br>&nbsp; &nbsp; Application.Icon.Handle := LoadIcon(HInstance,'MAINICON');<br>&nbsp; &nbsp; Index:=0;<br>&nbsp; end;<br>&nbsp; Icon.Assign(Application.Icon);<br><br>任何icon都可以调,没有问题的
 
jjqqw你好,你的回答我调试了,运行的很好,可是我想做一个类似QQ消息通知那样的东东,具体地说,我们都有QQ吧,当你的好友给你发消息过来的时候,托盘里面不是有个图标一闪一闪的,不知道我说清楚了没有?(想让我自己的图标动起来)<br><br>&nbsp; &nbsp; &nbsp; (我的分数太少了,呵呵~~~~~~~!)
 
jjqqw你好,我已经找到答案了,写在下面,期待与你共勉!<br><br>1。首先定义一个Imagelist对象(或者干脆放一个控件在窗体上面),加入两个图标。<br>2。定义两个TIcon对象,使用ImageList的GetIcon方法将图标读到这两个TIcon对象里面:<br>&nbsp; &nbsp; &nbsp; ImageList1.GetIcon(0,Ico1);<br>&nbsp; &nbsp; &nbsp; ImageList1.GetIcon(1,Ico2);<br>3。然后在需要图标句柄的地方使用,我是这样用的:<br>&nbsp; &nbsp; &nbsp;var<br>&nbsp; &nbsp; &nbsp; &nbsp;a,b:TNotifyIconData;<br>&nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;.<br>&nbsp; &nbsp; &nbsp; &nbsp;.<br>&nbsp; &nbsp; &nbsp; &nbsp;a.hIcon:=Ico1.Handle;<br>&nbsp; &nbsp; &nbsp; &nbsp;b.hIcon:=Ico2.Handle;<br>&nbsp; &nbsp; &nbsp; &nbsp;.<br>&nbsp; &nbsp; &nbsp; &nbsp;.<br>&nbsp; &nbsp; &nbsp;end;<br><br>我调试了,还不错,谢谢你哈!
 
呵呵,我理解歪了啊,解决了就好,谢你的5分
 
后退
顶部