TO蔓草:
我根据你的功能重新写了一个TListEdit:
type
TListEdit = class(TCustomMemo)
private
FListEditPM: TListEditPM;
FButtonVisible: Boolean;
FButtonFlat: Boolean;
FOnButtonClick: TNotifyEvent;
FListString: TStrings;
procedure SetButtonVisible(const Value: Boolean);
procedure SetButtonBounds;
procedure SetButtonFlat(const Value: Boolean);
function GetButtonHint: string;
procedure SetButtonHint(const Value: string);
procedure WM_LBUTTONDBLCLK(var Msg: TWMMouse); message WM_LBUTTONDBLCLK;
procedure WM_KEYDOWN(var Msg: TWMKey); message WM_KEYDOWN;
procedure SetListString(const Value: TStrings);
procedure OnListItemSelect(const AStr: string);
function ShowHideSelectList: Boolean;
protected
FButton: TSpeedButton;
procedure BtnClickHandler(Sender: TObject); virtual;
procedure UpdateFormatRect;
procedure WMSize(var Msg: TWMSize); message WM_SIZE;
procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
procedure CMEnabledChanged(var Msg: TWMNoParams); message CM_ENABLEDCHANGED;
procedure CreateHandle; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
published
property ButtonVisible: Boolean read FButtonVisible write SetButtonVisible default True;
property ButtonFlat: Boolean read FButtonFlat write SetButtonFlat;
property ButtonHint: string read GetButtonHint write SetButtonHint;
property ListString: TStrings read FListString write SetListString;
...
其中大部份代码是我以前写的现在正在用的一个控件中移过来的,所以BUG方面应该比较少
有兴趣的话告诉我EMAIL,给你发一份。[
]