61 lines
1.4 KiB
Plaintext
61 lines
1.4 KiB
Plaintext
type tcustomcontrol=class(TWinControl)
|
|
uses utslvclauxiliary;
|
|
{**
|
|
@explan(说明) 自绘制窗口控件 %%
|
|
**}
|
|
private
|
|
FOnPaint:TNotifyEvent;
|
|
protected
|
|
procedure PaintWindow(DC:HDC);override;
|
|
begin
|
|
//odh := canvas.Handle;
|
|
Canvas.Handle := dc;
|
|
Canvas.ClipRect := PAINTSTRUCT().rcpaint();
|
|
try
|
|
Paint();
|
|
finally
|
|
Canvas.Handle := odh;
|
|
end;
|
|
end
|
|
procedure Paint();override;
|
|
begin
|
|
inherited;
|
|
if datatype(FOnPaint)=7 then call(FOnPaint,self(true));
|
|
end
|
|
public
|
|
function Create(AOwner:TComponent);override;
|
|
begin
|
|
inherited;
|
|
includestate(FControlState,csCustomPaint);
|
|
//FCanvas := new tcanvas();
|
|
end
|
|
function CreateParams(p);override;
|
|
begin
|
|
inherited;
|
|
//p.style .|= WS_CLIPSIBLINGS .| WS_CLIPCHILDREN;
|
|
end
|
|
function Recycling();override;
|
|
begin
|
|
FOnPaint := nil;
|
|
inherited;
|
|
end
|
|
function DoVScroll(o,e);virtual;
|
|
begin
|
|
end
|
|
function DoHScroll(o,e);virtual;
|
|
begin
|
|
end
|
|
public
|
|
function WMVScroll(o,e):LM_VScroll;virtual;
|
|
begin
|
|
return DoVScroll(o,e);
|
|
end
|
|
function WMHScroll(o,e):LM_HSCROLL;virtual;
|
|
begin
|
|
return DoHScroll(o,e);
|
|
end
|
|
property OnPaint:eventhandler read FOnPaint write FOnPaint;
|
|
{**
|
|
@param(OnPaint)(function[TCustomControl,tuieventbase]) 窗口关闭消息回调 %%
|
|
**}
|
|
end; |