求一个简单的edit 的vcl

解决方案 »

  1.   

    TEdit = class(TCustomEdit)
      published
        property Anchors;
        property AutoSelect;
        property AutoSize;
        property BevelEdges;
        property BevelInner;
        property BevelKind default bkNone;
        property BevelOuter;
        property BiDiMode;
        property BorderStyle;
        property CharCase;
        property Color;
        property Constraints;
        property Ctl3D;
        property DragCursor;
        property DragKind;
        property DragMode;
        property Enabled;
        property Font;
        property HideSelection;
        property ImeMode;
        property ImeName;
        property MaxLength;
        property OEMConvert;
        property ParentBiDiMode;
        property ParentColor;
        property ParentCtl3D;
        property ParentFont;
        property ParentShowHint;
        property PasswordChar;
        property PopupMenu;
        property ReadOnly;
        property ShowHint;
        property TabOrder;
        property TabStop;
        property Text;
        property Visible;
        property OnChange;
        property OnClick;
        property OnContextPopup;
        property OnDblClick;
        property OnDragDrop;
        property OnDragOver;
        property OnEndDock;
        property OnEndDrag;
        property OnEnter;
        property OnExit;
        property OnKeyDown;
        property OnKeyPress;
        property OnKeyUp;
        property OnMouseDown;
        property OnMouseMove;
        property OnMouseUp;
        property OnStartDock;
        property OnStartDrag;
      end;
      

  2.   

    TCustomEdit = class(TWinControl)
      private
        FMaxLength: Integer;
        FBorderStyle: TBorderStyle;
        FPasswordChar: Char;
        FReadOnly: Boolean;
        FAutoSize: Boolean;
        FAutoSelect: Boolean;
        FHideSelection: Boolean;
        FOEMConvert: Boolean;
        FCharCase: TEditCharCase;
        FCreating: Boolean;
        FModified: Boolean;
        FOnChange: TNotifyEvent;
        procedure AdjustHeight;
        function GetModified: Boolean;
        function GetCanUndo: Boolean;
        procedure SetBorderStyle(Value: TBorderStyle);
        procedure SetCharCase(Value: TEditCharCase);
        procedure SetHideSelection(Value: Boolean);
        procedure SetMaxLength(Value: Integer);
        procedure SetModified(Value: Boolean);
        procedure SetOEMConvert(Value: Boolean);
        procedure SetPasswordChar(Value: Char);
        procedure SetReadOnly(Value: Boolean);
        procedure SetSelText(const Value: string);
        procedure UpdateHeight;
        procedure WMSetFont(var Message: TWMSetFont); message WM_SETFONT;
        procedure CMCtl3DChanged(var Message: TMessage); message CM_CTL3DCHANGED;
        procedure CMEnter(var Message: TCMGotFocus); message CM_ENTER;
        procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
        procedure CNCommand(var Message: TWMCommand); message CN_COMMAND;
        procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
        procedure WMContextMenu(var Message: TWMContextMenu);
          message WM_CONTEXTMENU;
      protected
        procedure Change; dynamic;
        procedure CreateParams(var Params: TCreateParams); override;
        procedure CreateWindowHandle(const Params: TCreateParams); override;
        procedure CreateWnd; override;
        procedure DestroyWnd; override;
        procedure DoSetMaxLength(Value: Integer); virtual;
        function GetSelLength: Integer; virtual;
        function GetSelStart: Integer; virtual;
        function GetSelText: string; virtual;
        procedure SetAutoSize(Value: Boolean); override;
        procedure SetSelLength(Value: Integer); virtual;
        procedure SetSelStart(Value: Integer); virtual;
        property AutoSelect: Boolean read FAutoSelect write FAutoSelect default True;
        property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
        property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle;
        property CharCase: TEditCharCase read FCharCase write SetCharCase default ecNormal;
        property HideSelection: Boolean read FHideSelection write SetHideSelection default True;
        property MaxLength: Integer read FMaxLength write SetMaxLength default 0;
        property OEMConvert: Boolean read FOEMConvert write SetOEMConvert default False;
        property PasswordChar: Char read FPasswordChar write SetPasswordChar default #0;
        property ParentColor default False;
        property ReadOnly: Boolean read FReadOnly write SetReadOnly default False;
        property OnChange: TNotifyEvent read FOnChange write FOnChange;
      public
        constructor Create(AOwner: TComponent); override;
        procedure Clear; virtual;
        procedure ClearSelection;
        procedure CopyToClipboard;
        procedure CutToClipboard;
        procedure DefaultHandler(var Message); override;
        procedure PasteFromClipboard;
        procedure Undo;
        procedure ClearUndo;
        function GetSelTextBuf(Buffer: PChar; BufSize: Integer): Integer; virtual;
        procedure SelectAll;
        procedure SetSelTextBuf(Buffer: PChar);
        property CanUndo: Boolean read GetCanUndo;
        property Modified: Boolean read GetModified write SetModified;
        property SelLength: Integer read GetSelLength write SetSelLength;
        property SelStart: Integer read GetSelStart write SetSelStart;
        property SelText: string read GetSelText write SetSelText;
        property Text;
      published
        property TabStop default True;
      end;
      

  3.   

    抱歉,我想要的是一个继承EDIT的VCL,并适当的加一些方法。
      

  4.   

    hehe...
    你不说自己要加什么方法,别人怎么给你写呀?
    这是最简单的类的继承,基本上每本书上都有例子的...