二级考试DELPHI辅导:特色按钮计算机等级考试

文章作者 100test 发表时间 2009:07:16 18:33:29
来源 100Test.Com百考试题网


  每当用到DELPHI自带的控件都感到少了一点什么,形状也好,颜色也好,变化的方式也好,都与自已的项目所需要的标准相差了一些,查阅了一些书籍后发现下面的控件很有可用之处!!!
  以下是它的源代码:
  unit DsFancyButton.
  interface
  uses
  SysUtils,Windows, Messages, Classes, Graphics, Controls, Forms.
  type
  TTextStyle = (txNone, txLowered, txRaised, txShadowed).
  TShape = (shCapsule, shOval, shRectangle, shRoundRect).
  TDsFancyButton = class(TGraphicControl)
  private
  FButtonColor: TColor.
  FIsDown: Boolean.
  FFrameColor: TColor.
  FFrameWidth: Integer.
  FCornerRadius: Integer.
  FRgn, MRgn: HRgn.
  FShape: TShape.
  FTextColor: TColor.
  FTextStyle: TTextStyle.
  procedure SetButtonColor(Value: TColor).
  procedure CMEnabledChanged(var message: TMessage).
  message CM_ENABLEDCHANGED.
  procedure CMTextChanged(var message: TMessage).
  message CM_TEXTCHANGED.
  procedure CMDialogChar(var message: TCMDialogChar).
  message CM_DIALOGCHAR.
  procedure WMSize(var message: TWMSize). message WM_PAINT.
  protected
  procedure Click. override.
  procedure DrawShape.
  procedure Paint. override.
  procedure SetFrameColor(Value: TColor).
  procedure SetFrameWidth(Value: Integer).
  procedure SetCornerRadius(Value: Integer).
  procedure SetShape(Value: TShape).
  procedure SetTextStyle(Value: TTextStyle).
  procedure WMLButtonDown(var Message: TWMLButtonDown). message WM_LBUTTONDOWN.
  procedure WMLButtonUp(var Message: TWMLButtonUp). message WM_LBUTTONUP.
  procedure WriteCaption.
  public
  constructor Create(Aowner: TComponent). override.
  destructor Destroy. override.
  published
  property ButtonColor: TColor
  read FButtonColor write SetButtonColor.
  property Caption.
  property DragCursor.
  property DragMode.
  property Enabled.
  property Font.
  property FrameColor: TColor
  read FFrameColor write SetFrameColor.
  property FrameWidth: Integer
  read FFrameWidth write SetFrameWidth.
  property ParentFont.
  property ParentShowHint.
  property PopupMenu.
  property CornerRadius: Integer
  read FCornerRadius write SetCornerRadius.
  property Shape: TShape
  read FShape write SetShape default shRoundRect.
  property ShowHint.
  property TextStyle: TTextStyle
  read FTextStyle write SetTExtStyle.
  property Visible.
  property OnClick. property OnDragDrop.
  property OnDragOver. property OnEndDrag.
  property OnMouseDown. Property OnMouseUp.
  Property OnMouseMove.
  end.
  procedure Register.
  implementation
  constructor TDsFancyButton.Create(AOwner: TComponent).

相关文章


如何将界面代码和功能代码分离(基于Delphi_VCL)计算机等级考试
自制支持文件拖放的VCL组件计算机等级考试
用DELPHI编制Windows95下的钩子函数计算机等级考试
在Delphi的DBGrid中插入其他可视组件计算机等级考试
二级考试DELPHI辅导:特色按钮计算机等级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛