新建一个组件,从TCustomEdit继承,新组件与TEdit差不多,就是多了一个属性:property con_enable:boolean read ……;以及两个私有变量tempstr1:string;
tempstr2:string;现在想根据con_enable的值是true还是false,决定在新组件的Text属性中显示
tempstr1 还是 tempstr1+tempstr2;怎样才能做到?
tempstr2:string;现在想根据con_enable的值是true还是false,决定在新组件的Text属性中显示
tempstr1 还是 tempstr1+tempstr2;怎样才能做到?
解决方案 »
- 求解!!串口返回的数据中添加中文说明,具体见文章内容
- 生成十字坐标----如何写一个简单的绘图类?
- 三层结构中中文参数传递的问题!请大家帮帮忙!!!
- 如何用delphi写一个含ado组件的dll在pb上调用
- 请问使用Windows Media Player这个ACTIVEX控件播放时,如何全屏播放,欢迎高手出招!
- 招聘兼职Delphi程序员(天津)
- 如何做到子窗体最小化后和父窗体一样,在任务栏上也有一个最小化后的任务条
- 线程操作IMAGE问题。
- 在delphi 程序中如何控制输入法的全半角?
- 一个关于用NMSMTP控件发邮件的问题
- dock的问题
- 请问:如何在窗体中得到名为A10的button,并对它操作
private
Fcon_enable:Boolean;
procedure Setcon_enable;
property con_enable:boolean read Fcon_enable write Setcon_enable;proceduer Setcon_enable;
begin
if con_enable then Text:=tempstr1
else Text:=tempstr1+tempstr2;
end;大体思路如上,你下看看可否满足要求
Fcon_enable:Boolean;
procedure Setcon_enable(const Value: boolean);
published
property con_enable:boolean read Fcon_enable write Setcon_enable;procedure Setcon_enable(const Value: boolean);
begin
Fcon_enable := Value;
if con_enable then Text:=tempstr1
else Text:=tempstr1+tempstr2;
end;
没有必要overidepaint过程的
在处理过程中加入对Fcon_enable的判断即可。