5,392
社区成员
发帖
与我相关
我的任务
分享
interface
uses
Messages, Windows, Graphics, ComCtrls;
type
TMyRichEdit = class(TRichEdit)
procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
end;
implementation
{ TMyRichEdit }
procedure TMyRichEdit.WMPaint(var Message: TWMPaint);
var
ACanvas: Tcanvas;
X1, X2, Y,t,i: Integer;
byLineLength: BYTE;
begin
inherited;
aCanvas := TCanvas.Create;
Y := Self.Height;
try
ACanvas.Handle := GetDC(Self.Handle);
t:=2+Self.DefAttributes.Height+6;
aCanvas.Pen.Color:=clskyblue;
acanvas.Pen.width:=1;
for i := 0 to Self.Lines.Count - 1 do
begin
With ACanvas do
Begin
Begin
MoveTo(Self.Left+2,t); // Draw line after 80 characters
LineTo(Self.Width-1,t);
End;
end;
t:=t+Self.DefAttributes.Height+5;
end
Finally
ReleaseDC(Self.Handle,ACanvas.Handle);
ACanvas.Free;
End;
end;
然后动态创建这个控件即可