mouse over이벤트로 bitbtn 이미지를 바꿀려구 하는데안되네요
CM_MOUSELEAVE를 안먹는것 같아요 CM_MOUSEENTER는 먹는데
시간때문에 그러나요. font색같은건 단번에 잘 바뀌는데요.
전문가님 아래 소스좀 수정해 주세요
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ImgList, Buttons;
type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
ImageList1: TImageList;
BitBtn2: TBitBtn;
private
{ Private declarations }
procedure WndProc(var Message: TMessage); override;
public
{ Public declarations }
procedure ChangeImage(Sender: TObject; Msg: Integer);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WndProc(var Message: TMessage);
begin
if Message.LParam = Longint(Bitbtn1) then
ChangeImage(Bitbtn1, Message.Msg);
if Message.LParam = Longint(Bitbtn2) then
ChangeImage(Bitbtn2, Message.Msg);
inherited WndProc(Message);
end;
procedure TForm1.ChangeImage(Sender: TObject; Msg: Integer);
Begin
if Sender is Tbitbtn then
begin
if (Msg = CM_MOUSELEAVE) then
begin
imagelist1.GetBitmap(2, TBitbtn(Sender).Glyph );
TBitbtn(Sender).Font.Color := clred;
end;
if (Msg = CM_MOUSEENTER) then
begin
imagelist1.GetBitmap(1 ,TBitbtn(Sender).Glyph ) ;
TBitbtn(Sender).Font.Color := clblue;
end;
end;
end;
end.
반갑습니다.
이런거에 대한 예제를 보내드리지요..
아래의 주소입니다.
http://user.chollian.net/~garam4g/cal.ZIP
그럼 수고하십시요~
궁금이 wrote:
> mouse over이벤트로 bitbtn 이미지를 바꿀려구 하는데안되네요
> CM_MOUSELEAVE를 안먹는것 같아요 CM_MOUSEENTER는 먹는데
> 시간때문에 그러나요. font색같은건 단번에 잘 바뀌는데요.
> 전문가님 아래 소스좀 수정해 주세요
>
> unit Unit1;
>
> interface
>
> uses
> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
> StdCtrls, ImgList, Buttons;
>
> type
> TForm1 = class(TForm)
> BitBtn1: TBitBtn;
> ImageList1: TImageList;
> BitBtn2: TBitBtn;
>
> private
> { Private declarations }
> procedure WndProc(var Message: TMessage); override;
>
> public
> { Public declarations }
> procedure ChangeImage(Sender: TObject; Msg: Integer);
> end;
>
> var
> Form1: TForm1;
>
> implementation
> {$R *.DFM}
>
> procedure TForm1.WndProc(var Message: TMessage);
> begin
>
>
> if Message.LParam = Longint(Bitbtn1) then
> ChangeImage(Bitbtn1, Message.Msg);
> if Message.LParam = Longint(Bitbtn2) then
> ChangeImage(Bitbtn2, Message.Msg);
>
> inherited WndProc(Message);
> end;
>
>
> procedure TForm1.ChangeImage(Sender: TObject; Msg: Integer);
> Begin
> if Sender is Tbitbtn then
> begin
> if (Msg = CM_MOUSELEAVE) then
> begin
> imagelist1.GetBitmap(2, TBitbtn(Sender).Glyph );
> TBitbtn(Sender).Font.Color := clred;
> end;
>
> if (Msg = CM_MOUSEENTER) then
> begin
> imagelist1.GetBitmap(1 ,TBitbtn(Sender).Glyph ) ;
> TBitbtn(Sender).Font.Color := clblue;
> end;
>
> end;
>
>
> end;
>
> end.
>