CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  VCL组件开发及应用

TImgBtn 组件的安装

楼主kingbin(co)2004-11-01 16:50:03 在 Delphi / VCL组件开发及应用 提问

在网上下在了一个TImgBtn组件  
  可是怎么安装啊?没有dpk文件  
  只有一个.Pas   和一个.res文件  
  .pas内容如下  
  unit   ImgBtn;  
   
  //*   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   *//  
  //*     ImgBtn.   Delphi   3,   4  
  //*  
  //*   This   component   turns   3   images   to   button   with   3   states   :   normal,   MouseOver  
  //*   and   Pressed.   I've   also   added   some   importent   events.  
  //*  
  //*   Writen   by   Paul   Krestol.  
  //*   For   contacts   e-mail   me   to   :   paul@mediasonic.co.il  
  //*   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   *//  
   
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Classes,   Graphics,   Controls,   Forms,   Dialogs,  
      ExtCtrls;  
   
  type  
      TOnMouseEvent   =   procedure(   Msg:   TWMMouse   )   of   object;  
   
      TImgBtn   =   class(   TImage   )  
      protected  
          procedure   WMMouseEnter(   var   Msg   :   TWMMouse   );   message   CM_MOUSEENTER;  
          procedure   WMMouseLeave(   var   Msg   :   TWMMouse   );   message   CM_MOUSELEAVE;  
          procedure   WMLButtonUp(   var   Msg   :   TWMLButtonUp   );   message   WM_LBUTTONUP;  
          procedure   WMLButtonDown(   var   Msg   :   TWMLButtonUp   );   message   WM_LBUTTONDOWN;  
      private  
          FEntered   :   boolean;  
          FDown   :   boolean;  
          FOnMouseEnter   :   TOnMouseEvent;  
          FOnMouseLeave   :   TOnMouseEvent;  
          FOnMouseDown     :   TOnMouseEvent;  
          FOnMouseUp         :   TOnMouseEvent;  
          FPic   :   TPicture;  
          FPicDown   :   TPicture;  
          FPicUp   :   TPicture;  
          FSupported   :   boolean;  
          procedure   SetPic(   Value   :   TPicture   );  
          procedure   SetPicDown(   Value   :   TPicture   );  
          procedure   SetPicUp(   Value   :   TPicture   );  
      public  
          constructor   Create(   AOwner:   TComponent   );   override;  
          destructor   Destroy;   override;  
      published  
          //**   Images   **//  
          property   Pic   :   TPicture   read   FPic   write   SetPic;  
          property   PicDown   :   TPicture   read   FPicDown   write   SetPicDown;  
          property   PicUp   :   TPicture   read   FPicUp   write   SetPicUp;  
          //**   Events   **//  
          property   OnMouseDown   :   TOnMouseEvent   read   FOnMouseDown   write   FOnMouseDown;  
          property   OnMouseEnter   :   TOnMouseEvent   read   FOnMouseEnter   write   FOnMouseEnter;  
          property   OnMouseLeave   :   TOnMouseEvent   read   FOnMouseLeave   write   FOnMouseLeave;  
          property   OnMouseUp   :   TOnMouseEvent   read   FOnMouseUp   write   FOnMouseUp;  
          property   Supported   :   boolean   read   FSupported   write   FSupported;  
      end;  
   
  procedure   Register;  
   
  implementation  
  {$R   *.RES}  
   
  (*******************************************************************************)  
  procedure   Register;  
  begin  
      RegisterComponents(   'Plus',   [   TImgBtn   ]   );  
  end;  
   
  (*******************************************************************************)  
  constructor   TImgBtn.Create;  
  begin  
      inherited;  
      FPic   :=   TPicture.Create;  
      FPicUp   :=   TPicture.Create;  
      FPicDown   :=   TPicture.Create;  
      FEntered   :=   False;  
      FDown   :=   False;  
      FSupported   :=   True;  
  end;  
   
  (*******************************************************************************)  
  destructor   TImgBtn.Destroy;  
  begin  
      FPic.Free;  
      FPicDown.Free;  
      FPicUp.Free;  
      inherited;  
  end;  
   
  (*******************************************************************************)  
  procedure   TImgBtn.WMMouseEnter(   var   Msg:   TWMMouse   );  
  begin  
      if   not   FSupported   then   Exit;  
      FEntered   :=   True;  
      if   FDown   then   Picture   :=   FPicDown   else   Picture   :=   FPicUp;  
      if   Assigned(   FOnMouseEnter   )   then   FOnMouseEnter(   Msg   );  
  end;  
   
  (*******************************************************************************)  
  procedure   TImgBtn.WMMouseLeave(   var   Msg:   TWMMouse   );  
  begin  
      if   not   FSupported   then   Exit;  
      FEntered   :=   False;  
      Picture   :=   FPic;  
      if   Assigned(   FOnMouseLeave   )   then   FOnMouseLeave(   Msg   );  
  end;  
   
  (*******************************************************************************)  
  procedure   TImgBtn.WMLButtonDown(var   Msg:   TWMMouse);  
  begin  
      inherited;  
      if   not   FSupported   then   Exit;  
      FDown   :=   True;  
      if   FEntered   then   Picture   :=   FPicDown;  
      if   Assigned(   FOnMouseDown   )   then   FOnMouseDown(   Msg   );  
  end;  
   
  (*******************************************************************************)  
  procedure   TImgBtn.WMLButtonUp(var   Msg:   TWMMouse);  
  begin  
      inherited;  
      if   not   FSupported   then   Exit;  
      FDown   :=   False;  
      if   FEntered   then   Picture   :=   FPicUp;  
      if   Assigned(   FOnMouseUp   )   then   FOnMouseUp(   Msg   );  
  end;  
   
  (*******************************************************************************)  
  procedure   TImgBtn.SetPic(   Value   :   TPicture   );  
  begin  
      Picture   :=   Value;  
      FPic.Assign(   Value   );  
  end;  
   
  (*******************************************************************************)  
  procedure   TImgBtn.SetPicDown(   Value   :   TPicture   );  
  begin  
      FPicDown.Assign(   Value   );  
  end;  
   
  (*******************************************************************************)  
  procedure   TImgBtn.SetPicUp(   Value   :   TPicture   );  
  begin  
      FPicUp.Assign(   Value   );  
  end;  
   
  end.  
  问题点数:10、回复次数:3Top

1 楼whbo(王红波(年轻人,要有所作为))回复于 2004-11-01 18:59:45 得分 4

component   new试试看Top

2 楼g961681(技术庸人(情商太低))回复于 2004-11-01 21:45:02 得分 2

自己建个dpk,然后把他加进去再安装!Top

3 楼sailxia(小帆)回复于 2004-11-02 08:47:41 得分 4

only   for   D3,4?可能吧?  
  如果支持全部版本,可以这样试一试:  
  菜单:-->Component-->Install   Component-->选择第一行的"browse"-->选择"ImgBtn.pas"-->OK-->YES  
   
  在关闭面板的时候选择"YES"保存编译.Top

相关问题

  • COM组件安装!
  • 组件安装出错
  • 组件安装出错???
  • ds_fancy1.1组件的安装
  • DSPACK组件怎么安装?
  • windows 的组件服务 问题,如何自动安装组件?
  • 组件安装的两个问题
  • delphi的 组件的安装问题
  • 自定义组件的安装问题!!!!!
  • d6下组件安装的问题?

关键词

  • timgbtn
  • twmmouse
  • procedure
  • var msg
  • message

得分解答快速导航

  • 帖主:kingbin
  • whbo
  • g961681
  • sailxia

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo