一年前自己的辕马,提示找不到NSTrEdit.dcu,忘记了是什么控件?(80分)

L

laowt

Unregistered / Unconfirmed
GUEST, unregistred user!
一年前自己的辕马,提示找不到NSTrEdit.dcu,忘记了是什么控件?
请指点,马上结帐!!
 
将其去掉,在下句
SendMessage(NSTransRichEdit1.Handle, WM_SETREDRAW, 0, 0);
出现错误提示!
 
不知道是不是这个,我也是网上找来的
unit NSTrEdit;
interface
uses Windows, Messages, Controls, StdCtrls, classes, Graphics, ComCtrls, RXRichEd;
const TMWM_SpecialInvalidate=WM_USER+1111;
type
TNSTransEdit = class(TEdit)
private
procedure SpecialInvalidate(var Message:TMessage);
message TMWM_SpecialInvalidate;
procedure WMSetText(var Message:TWMSetText);
message WM_SETTEXT;
procedure WMLButtonDown(Var Message: TWMLButtonDown);
Message WM_LButtonDown;
procedure EMReplaceSel(var Message: TMessage);
Message EM_REPLACESEL;
procedure WMKillFocus(Var Message: TWMKillFocus);
Message WM_KillFocus;
procedure CNCTLCOLOREDIT(var Message:TWMCTLCOLOREDIT);
message CN_CTLCOLOREDIT;
procedure WMKeyDown(var Message: TWMKeyDown);
message WM_KEYDOWN;
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd);
message WM_ERASEBKGND;
protected
procedure CreateParams(var Params: TCreateParams);
override;
public
constructor Create(AOwner: TComponent);
override;
end;

TNSTransMemo = class(TMemo)
private
procedure SpecialInvalidate(var Message:TMessage);
message TMWM_SpecialInvalidate;
procedure WMHScroll(var Message: TWMHScroll);
message WM_HSCROLL;
procedure WMVScroll(var Message: TWMVScroll);
message WM_VSCROLL;
procedure WMSetText(var Message:TWMSetText);
message WM_SETTEXT;
procedure WMLButtonDown(Var Message: TWMLButtonDown);
Message WM_LButtonDown;
procedure WMKillFocus(Var Message: TWMKillFocus);
Message WM_KillFocus;
procedure CNCTLCOLOREDIT(var Message:TWMCTLCOLOREDIT);
message CN_CTLCOLOREDIT;
procedure WMKeyDown(var Message: TWMKeyDown);
message WM_KEYDOWN;
procedure EMReplaceSel(var Message: TMessage);
message EM_REPLACESEL;
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd);
message WM_ERASEBKGND;
procedure WMPaint(var Message: TWMPaint);
message WM_Paint;
protected
procedure CreateParams(var Params: TCreateParams);
override;
public
constructor Create(AOwner: TComponent);
override;
end;

TNSTransRichEdit = class(TRXRichEdit)
private
procedure SpecialInvalidate(var Message:TMessage);
message TMWM_SpecialInvalidate;
procedure WMHScroll(var Message: TWMHScroll);
message WM_HSCROLL;
procedure WMVScroll(var Message: TWMVScroll);
message WM_VSCROLL;
procedure WMSetText(var Message:TWMSetText);
message WM_SETTEXT;
procedure WMLButtonDown(Var Message: TWMLButtonDown);
Message WM_LButtonDown;
procedure CNCTLCOLOREDIT(var Message:TWMCTLCOLOREDIT);
message CN_CTLCOLOREDIT;
procedure WMKeyDown(var Message: TWMKeyDown);
message WM_KEYDOWN;
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd);
message WM_ERASEBKGND;
protected
procedure CreateParams(var Params: TCreateParams);
override;
public
constructor Create(AOwner: TComponent);
override;
end;

procedure Register;
implementation
{ TNSTransEdit }
procedure TNSTransEdit.CNCTLCOLOREDIT(var Message:TWMCTLCOLOREDIT);
begin
with Messagedo
begin
SetBkMode(ChildDC,TRANSPARENT);
Result:=GetStockObject(HOLLOW_BRUSH)
end
end;

procedure TNSTransEdit.WMSetText(var Message:TWMSetText);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransEdit.SpecialInvalidate(var Message:TMessage);
var r:TRect;
begin
if Parent<>nil then
begin
r:=ClientRect;
r.TopLeft:=Parent.ScreenToClient(ClientToScreen(r.TopLeft));
r.BottomRight:=Parent.ScreenToClient(ClientToScreen(r.BottomRight));
InvalidateRect(Parent.Handle,@r,false);
RedrawWindow(Handle,nil,0,RDW_FRAME+RDW_INVALIDATE)
end;
end;

procedure TNSTransEdit.WMKeyDown(var Message: TWMKeyDown);
begin
// SendMessage(Handle,TMWM_SpecialInvalidate,0,0);
inherited;
PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
end;

procedure TNSTransEdit.WMLButtonDown(Var Message: TWMLButtonDown);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransEdit.WMKillFocus(Var Message: TWMKillFocus);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransEdit.EMReplaceSel(var Message: TMessage);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransEdit.WMEraseBkgnd(var Message: TWMEraseBkgnd);
begin
Message.Result:=1;
PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
end;

constructor TNSTransEdit.Create(AOwner: TComponent);
begin
inherited;
ControlStyle:=[csCaptureMouse, csDesignInteractive,
csClickEvents, csOpaque, csDoubleClicks,
csReplicatable, csNoStdEvents];
// csSetCaption,
end;

procedure TNSTransEdit.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Paramsdo
begin
ExStyle:=ExStyle or WS_EX_TRANSPARENT and not WS_EX_WINDOWEDGE
and not WS_EX_STATICEDGE and not WS_EX_DLGMODALFRAME and not
WS_EX_CLIENTEDGE;
WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
end;
end;
{ TNSTransMemo }
procedure TNSTransMemo.WMHScroll(var Message: TWMHScroll);
begin
PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
inherited;
end;

procedure TNSTransMemo.WMVScroll(var Message: TWMVScroll);
begin
// SendMessage(Handle,TMWM_SpecialInvalidate,0,0);
PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
inherited;
end;

procedure TNSTransMemo.WMLButtonDown(Var Message: TWMLButtonDown);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransMemo.WMPaint(Var Message: TWMPaint);
begin
Brush.Style:= bsClear;
inherited;
end;

procedure TNSTransMemo.WMKillFocus(Var Message: TWMKillFocus);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransMemo.CNCTLCOLOREDIT(var Message:TWMCTLCOLOREDIT);
begin
with Messagedo
begin
SetBkMode(ChildDC,TRANSPARENT);
Result:=GetStockObject(HOLLOW_BRUSH)
end
end;

procedure TNSTransMemo.WMSetText(var Message:TWMSetText);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransMemo.EMReplaceSel(var Message: TMessage);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransMemo.SpecialInvalidate(var Message:TMessage);
var r:TRect;
begin
if Parent<>nil then
begin
r:=ClientRect;
r.TopLeft:=Parent.ScreenToClient(ClientToScreen(r.TopLeft));
r.BottomRight:=Parent.ScreenToClient(ClientToScreen(r.BottomRight));
InvalidateRect(Parent.Handle,@r,false);
RedrawWindow(Handle,nil,0,RDW_FRAME+RDW_INVALIDATE);
end;
end;

procedure TNSTransMemo.WMKeyDown(var Message: TWMKeyDown);
begin
// SendMessage(Handle,TMWM_SpecialInvalidate,0,0);
PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
inherited;
end;

procedure TNSTransMemo.WMEraseBkgnd(var Message: TWMEraseBkgnd);
begin
Message.Result:=1;
PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
end;

constructor TNSTransMemo.Create(AOwner: TComponent);
begin
inherited;
ControlStyle:=[csCaptureMouse, csDesignInteractive,
csClickEvents, csOpaque, csDoubleClicks,
csReplicatable, csNoStdEvents];
// csSetCaption,
end;

procedure TNSTransMemo.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Paramsdo
begin
ExStyle:=ExStyle or WS_EX_TRANSPARENT and not WS_EX_WINDOWEDGE
and not WS_EX_STATICEDGE and not WS_EX_DLGMODALFRAME and not
WS_EX_CLIENTEDGE;
WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
end;
end;

{ TNSTransRichEdit }
procedure TNSTransRichEdit.WMHScroll(var Message: TWMHScroll);
begin
inherited;
// PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
end;

procedure TNSTransRichEdit.WMVScroll(var Message: TWMVScroll);
begin
// SendMessage(Handle,TMWM_SpecialInvalidate,0,0);
inherited;
// PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
end;

procedure TNSTransRichEdit.WMLButtonDown(Var Message: TWMLButtonDown);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransRichEdit.CNCTLCOLOREDIT(var Message:TWMCTLCOLOREDIT);
begin
with Messagedo
begin
SetBkMode(ChildDC,TRANSPARENT);
Result:=GetStockObject(HOLLOW_BRUSH)
end
end;
procedure TNSTransRichEdit.WMSetText(var Message:TWMSetText);
begin
inherited;
if not (csDesigning in ComponentState) then
PostMessage(Handle,TMWM_SpecialInvalidate,0,0)
end;

procedure TNSTransRichEdit.SpecialInvalidate(var Message:TMessage);
var r:TRect;
begin
if Parent<>nil then
begin
r:=ClientRect;
r.TopLeft:=Parent.ScreenToClient(ClientToScreen(r.TopLeft));
r.BottomRight:=Parent.ScreenToClient(ClientToScreen(r.BottomRight));
InvalidateRect(Parent.Handle,@r,false);
RedrawWindow(Handle,nil,0,RDW_FRAME+RDW_INVALIDATE)
end;
end;

procedure TNSTransRichEdit.WMKeyDown(var Message: TWMKeyDown);
begin
inherited;
end;

procedure TNSTransRichEdit.WMEraseBkgnd(var Message: TWMEraseBkgnd);
begin
Message.Result:=1;
PostMessage(Handle,TMWM_SpecialInvalidate,0,0);
end;

constructor TNSTransRichEdit.Create(AOwner: TComponent);
begin
inherited;
ControlStyle:=[csCaptureMouse, csDesignInteractive,
csClickEvents, csOpaque, csDoubleClicks,
csReplicatable, csNoStdEvents];
// csSetCaption,
end;

procedure TNSTransRichEdit.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Paramsdo
begin
ExStyle:=ExStyle or WS_EX_TRANSPARENT and not WS_EX_WINDOWEDGE
and not WS_EX_STATICEDGE and not WS_EX_DLGMODALFRAME and not
WS_EX_CLIENTEDGE;
WindowClass.style := WindowClass.style and not (CS_HREDRAW or CS_VREDRAW);
end;
end;

procedure Register;
begin
RegisterComponents('Netsoft', [TNSTransEdit, TNSTransMemo, TNSTransRichEdit]);
end;

end.
 
谢谢,不行,又是在那句挡住!
 
再试试,我改了下
 
接受答案了.
 
顶部