帮我看看这段代码怎么写才对!
unit EditEH;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
TStyleArray =(saFloat, saInt, saIP, saStr);
TEditEH = class(TEdit)
private
{ Private declarations }
FStyle : TStyleArray;
procedure SetText(const value: TStyleArray);
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property Style : TStyleArray read FStyle write SetText;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyVcl', [TEditEH]);
end;
procedure TEditEH.SetText(const value: TStyleArray);
begin
if FStyle = value then exit
else FStyle := value;
Invalidate;
end;
procedure TEditEH.KeyDown(var Key: Word; Shift: TShiftState);
begin
inherited KeyDown(Key, Shift);
if FStyle=saInt then
begin
if not(key in [48..57,8]) then
begin
key := 0;
end;
end
else if FStyle=saFloat then
begin
if not(key in [46,48..57,8]) then
begin
key := 0;
end;
end
else if FStyle=saIP then
begin
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
TStyleArray =(saFloat, saInt, saIP, saStr);
TEditEH = class(TEdit)
private
{ Private declarations }
FStyle : TStyleArray;
procedure SetText(const value: TStyleArray);
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property Style : TStyleArray read FStyle write SetText;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MyVcl', [TEditEH]);
end;
procedure TEditEH.SetText(const value: TStyleArray);
begin
if FStyle = value then exit
else FStyle := value;
Invalidate;
end;
procedure TEditEH.KeyDown(var Key: Word; Shift: TShiftState);
begin
inherited KeyDown(Key, Shift);
if FStyle=saInt then
begin
if not(key in [48..57,8]) then
begin
key := 0;
end;
end
else if FStyle=saFloat then
begin
if not(key in [46,48..57,8]) then
begin
key := 0;
end;
end
else if FStyle=saIP then
begin
end;
end;
end.
...全文
相关推荐
GPT-4 Copilot X震撼来袭!AI写代码效率10倍提升
GPT-4加强版Copilot来了!刚刚,GitHub发布了新一代代码生成工具GitHub Copilot X,动嘴写代码不再是梦。 微软真的疯了!微软刚用GPT-4升级了Office办公全家桶,还没等人们反应过来,微软又来抄码农的家了。GitHub官宣:基于GPT-4的新一代代码生成工具Copilot X来了!GitHub Copilot发布还不到两年,就已经为100多万的开发者编写了46%的代码,并提高了55%的编码速度。而这次的重磅升级,更是强到发指。新一代Copilot X,直接整合里一个华丽的聊天界面,不仅动动嘴皮子就能生成代码,还能边写代码边跟AI对话,以及为你量身定做的智能文档系统等等。 GPT-4加持Copilot,动嘴就能写代码 具体来说,Copilot X提供支持的体验有:Copilot Chat;Copilot for Pull Request;Copilot for Docs;Copilot for CLI。这些新功能都是由OpenAI的GPT-4驱动的。值得注意的是,由于速度延迟的原因,代码自动补全工具仍基于GitHub的Codex模型上,该模型是在GPT-
Discuz! 忍帮圣诞风格
Discuz! 忍帮圣诞风格
Discuz! 忍帮圣诞模板
Discuz! 忍帮圣诞模板
14我应该感到自豪才对3
14我应该感到自豪才对3
14我应该感到自豪才对1
14我应该感到自豪才对1


