Edit也可以画出来,就是稍微麻烦一点,给大家贴一段试试看:<br>//Form中添加一个Edit和一个Timer,把Timer的Interval设置为500,事件设置为Timer1Timer即可<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls, Spin, ExtCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Edit1: TEdit;<br> Timer1: TTimer;<br> procedure Timer1Timer(Sender: TObject);<br> procedure FormCreate(Sender: TObject);<br> private<br> { Private declarations }<br> procedure DrawMyEdit;<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> SelIndex: Integer=1;<br> ShowFocus:Boolean=True;<br> ShowText: String='Edit1';<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.DrawMyEdit;<br>var<br> d: HDC;<br> r: TRect;<br> b, bb: HBRUSH;<br> s: String;<br>begin<br> d:=GetDC(Handle);<br> r:=Rect(0, 0, 100, 22);<br> b:=CreateSolidBrush(clWhite);<br> bb:=SelectObject(d, b);<br> FillRect(d, r, b);<br> SelectObject(d, bb);<br> DrawEdge(d, r, 10, BF_RECT);<br><br> InflateRect(r, -3, -3);<br><br> DrawText(d, PChar(ShowText), Length(ShowText), r, DT_EDITCONTROL);<br><br> if ShowFocus then<br> begin<br> s:=Copy(ShowText, 1, SelIndex);<br> if s<>'' then<br> begin<br> DrawText(d, PChar(s), Length(s), r, DT_EDITCONTROL or DT_CALCRECT);<br> InflateRect(r, 0, -1);<br> MoveToEx(d, r.Right, r.Top, nil);<br> LineTo(d, r.Right, r.Bottom);<br> end;<br> end;<br> <br> ReleaseDC(Handle, d);<br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>begin<br> ShowFocus:=not ShowFocus;<br> DrawMyEdit;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> Timer1.Interval:=500;<br>end;<br><br>end.