现在想法:是在画布上画个填充矩形,点击(判断click的范围在这个矩形内)后修改填充颜色,表示他的外观的变化。问题是:如何处理button的配置参数面板,就像我们在delphi中的样式,修改一下事件,属性信息,我的想法是做一个参数面板的form,画图窗体f1,和参数窗体f2之间通过传递消息,互相触发form内的函数相应变化。有没有更好的方法?还有我的button在运行的时候也是可以修改属性的。对这样的问题,大家帮我想想该怎么处理好。
解决方案 »
- 在广域网上 没有固定IP 能保证连接稳定吗
- 急求一个功能的实现方法
- 如何通过IP地址得到域名(DNS 反查)? eg: 209.143.154.82 => www.delphibbs.com (120分)
- 关于ERP的多层构架问题(高手,牛人,构架师,有经验的,愿交流者请进)
- 小弟写的文章,第一次写,希望大家支持
- 如何制作Delphi的安装包
- TQuery执行异常,我找不出原因,帮我看看!
- 这里有没有吉林大学的学生?交个朋友!
- 我有一个txt文件格式是 ****=???????????…………
- 怎样按某项对TList进行排序
- ADOquery经过filter后,如何快速得到当前的纪录数量.
- 通过哪个消息可以判断目标窗体已经加载完毕并触发一个动作?
//写入到日志中
//Duo
//080701
unit DuoLog;interfaceuses
Windows, Forms,Messages, SysUtils, Classes,Dialogs,DuoKitBaseClass;type
TBeforeDuoLog = procedure(var ALogStr:String) of object;
TAfterDuoLog = procedure(const AFileName,ALogStr:String) of object;
TPromptDuoLog = procedure(const APromptStr:String) of object;
TDuoLog = class(TDuoBase)
private
FFileName: TFileName;
FBeforeLog:TBeforeDuoLog;
FAfterLog:TAfterDuoLog;
FAutoNewLine: Boolean;
FEnabled: Boolean;
FVersion,FPath: String;
FOnPrompt: TPromptDuoLog;
function GetFullFileName: TFileName;
function GetVersion: String;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure LogIt(AStr:String);
procedure ResetIt;
published
property Version:String read GetVersion write FVersion;
property FileName:TFileName read FFileName write FFileName;
property Path:String read FPath write FPath;
property FullFileName:TFileName read GetFullFileName;
property OnBeforeLog:TBeforeDuoLog read FBeforeLog write FBeforeLog;
property OnAfterLog:TAfterDuoLog read FAfterLog write FAfterLog;
property AutoNewLine:Boolean read FAutoNewLine write FAutoNewLine;
property Enabled:Boolean read FEnabled write FEnabled;
property OnPrompt:TPromptDuoLog read FOnPrompt write FOnPrompt;
end;implementation{ TDuoLog }constructor TDuoLog.Create(AOwner: TComponent);
begin
inherited;
FAutoNewLine:=false;
FEnabled:=true;
if csDesigning in ComponentState then
FPath:=''
else FPath:=ExtractFilePath(Application.ExeName);
end;destructor TDuoLog.Destroy;
begin inherited;
end;function TDuoLog.GetFullFileName: TFileName;
begin
if FPath<>'' then
Result:=FPath+FFileName
else Result:=ExtractFilePath(Application.ExeName)+FFileName;
end;function TDuoLog.GetVersion: String;
begin
Result:='1.2';
end;procedure TDuoLog.LogIt(AStr: String);
var F:TextFile;ALogStr:String;
begin
if not FEnabled then exit;
if FFileName='' then exit;
AssignFile(F,FullFileName);
if FileExists(FullFileName) then
Append(F)
else Rewrite(F);
ALogStr:=AStr;
if Assigned(FBeforeLog) then FBeforeLog(ALogStr);
if FAutoNewLine then
WriteLn(F,ALogStr)
else Write(F,ALogStr);
Flush(F);
if Assigned(FAfterLog) then FAfterLog(FullFileName,ALogStr);
CloseFile(F);
end;procedure TDuoLog.ResetIt;
var s:String;
begin
s:=FullFileName;
if (s<>'')and FileExists(s) then
begin
if DeleteFile(s) and Assigned(FOnPrompt) then FOnPrompt('删除'+s);
end;
end;end.
改成
TDuoLog = class(TComponent)
定义这个按钮的属性和事件怎么做?现在没有太好的办法