> </P>
> </P>
> </P>4 k/ e" f5 A3 C0 X
>以生成一个TMemo的派生类及动态地创建该VCL控件为例。 </P>+ t7 S# n7 C; m j2 ]/ u& Z, D1 ^+ \
>Class TMemoEx : public TMemo </P>
>{ </P>
> . </P># F/ |: c& V1 x) f6 E
> . </P>
>} </P>
>extern TMemoEx memoex; </P>$ [6 @' y# d& F4 ~" A1 f
> </P>
>Class TForm1 : Class TForm </P>) R/ j2 N& [: D
>{ </P>. B8 A; `6 k; a y1 s. B0 c
>public: </P>
> TMemoEx *MemoEx; </P>( q m. M l8 o* U }
> . </P>
> . </P>
>} </P>2 y1 B: p& B. d \9 J
> </P>* b# r6 @ |. H- \1 S' T
>void _fastcall TForm1::FormShow(TObject *Sender) </P>
>{ </P>1 s0 m- p0 G3 x. J+ M
> MemoEx=new TMemoEx(this); </P>" K2 ?" \) q4 n I( \$ B( E& V
> MemoEx->
arent=this; </P>$ e1 D) |; Q' ]0 z! `
> . </P>4 ]/ ~* }4 M: v1 m/ Z; V; i/ Z
> . </P>. o9 [- K2 R) M3 P$ F
>} </P> }0 f$ b6 w& B! ]$ E! M
>总之,遵循以下步骤即可: </P>: U( t+ |) w. i7 S
> 类定义; </P># t& @0 }6 f$ ~& Q5 I
> extern TMemoEx memoex; </P>| 欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |