有无自带CANVAS的TMemo控件?(100分)

  • 主题发起人 主题发起人 pigprince
  • 开始时间 开始时间
P

pigprince

Unregistered / Unconfirmed
GUEST, unregistred user!
我的程序要使用编辑功能,还要在上面画图,简直是焦头烂额!
 
哈哈,好好好,这样的问题多来几个!!
你去看一看一个关于带背景的edit的贴子,有如下内容
////////for that note/////////
去down一套TBI_Library的源码级组件,就有了。
这套组件极COOL!!!!在图形处理方面远胜于rx_lib!是写界面程序的极
品,是aimingoo压箱底的东东!好舍不得给拿出来的哟!
^-^
http://www.b-ischo.horizont-is.net/zips/bi_lib.zip
////////for that note/////////

事实上,这个TBI_Library组件包里也有一个带背景的TMemo,
当然,这个TMemo也可以是透明的。
:)
Pigprince,下次再有这样的好事,可别忘了我哟。
 
Hi pigy,

给你的TMemo加上一个TControlCanvas既可以加入画图功能,另外在ControlStyle
set中加入caAcceptsControls就可以在它上面放置其他控件:

type
TCanvasMemo = class(TMemo)
private
fCanvas: TControlCanvas;
published
property Canvas: TControlCanvas read fCanvas write fCanvas;
public
constructor create(AOwner: TComponent);
destructor destory;
end;

implementation

constructor TCanvasMemo.create(AOwner: TComponent);
begin
inherited create(AOwner);
fCanvas := TControlCanvas.Create;
ControlStyle := ControlStyle + [csAcceptsControls];
end;

destructor TCanvasMemo.Destory;
begin
fCanvas.free;
inherited destory;
end;
 
其实实际上可以在任何TWinControl上画图,
关键是获得所谓HDC,设备环境

具体如下aWinControl是你想图的控件:

aCanvas:TCanvas;
aCanvas:=TCanvas.Create;
aCanvas.Handle:=GetDC(aWinControl.Handle);
->HDC ->HWND

然后可以使用任何TCanvas的函数了!

注意不需要时要Free;
aCanvas.Free;
 
first, thx all for ur kindly help,
but the component can't install in D3,
so i have to say sorry to aiming.

from now on i'll test the huizhang's reply.
 
first, thx all for ur kindly help,
but the component can't install in D3,
so i have to say sorry to aiming.

from now on i'll test the huizhang's reply.
 
huizhang's reply have a problem in compiler,
it's the inherited.

jiangtao's pass the test, so....

thx, for ur all!
 

Similar threads

D
回复
0
查看
832
DelphiTeacher的专栏
D
D
回复
0
查看
923
DelphiTeacher的专栏
D
后退
顶部