cdedit是什么组件?cdedit.dcu提示找不到?(0分)

  • 主题发起人 主题发起人 softyes
  • 开始时间 开始时间
S

softyes

Unregistered / Unconfirmed
GUEST, unregistred user!
cdedit是什么组件?cdedit.dcu提示找不到?
txtHostname : TCDEdit;

--------------------------------------------------------------------------------
txtHostname := TCDEdit.Create(Self);
txtHostname.Parent := UInfo;
txtHostname.Left := 260;
txtHostname.Top := 8;
txtHostname.Width := 148;
txtHostname.Height := 13;
txtHostname.Color := clBtnFace;
txtHostname.BorderStyle := bsNone;
txtHostname.TextAlignment := taRightJustify;
 
bonjour à tous,
je viens de lire vos post.
il faut créer le composant dans un unit,
type
TCDEdit = class(TEdit)
private
{ Déclarations privées }
FTextAlign: TAlignment;
FOnlyNumbers: boolean;
procedure SetOnlyNumbers(Value: boolean);
procedure SetTextAlign(Value: TAlignment);
protected
{ Déclarations protégées }
procedure CreateParams(var Params: TCreateParams); override;
public
{ Déclarations publiques }
constructor Create(AOwner: TComponent); override;
published
{ Déclarations publiées }
property OnlyNumbers: boolean read FOnlyNumbers write SetOnlyNumbers;
property TextAlignment: TAlignment read FTextAlign write SetTextAlign;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Exemples', [TCDEdit]);
end;

{ TCDEdit }

constructor TCDEdit.Create(AOwner: TComponent);
begin
inherited;
FTextAlign := taLeftJustify;
FOnlyNumbers := FALSE;
end;

procedure TCDEdit.CreateParams(var Params: TCreateParams);
const
Alignments: array[TAlignment] of Word = (ES_LEFT, ES_RIGHT, ES_CENTER);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or Alignments[TextAlignment];
if OnlyNumbers then
Params.Style := Params.Style or ES_NUMBER
end;

procedure TCDEdit.SetOnlyNumbers(Value: boolean);
begin
if FOnlyNumbers <> Value thenbegin
FOnlyNumbers := Value;
RecreateWnd;
end;
end;

procedure TCDEdit.SetTextAlign(Value: TAlignment);
begin
if FTextAlign <> Value thenbegin
FTextAlign := Value;
RecreateWnd;
end;
end;

end.

(ce code n'est pas de moi).
Salutations à tous et bon codding
Dugueclin.
 
Bonjour Adminsma,
Voici le code pour créer le composant dans le fichier .pfm:

object Edit1: TAlignEdit
Left = 64
Top = 20
Width = 180
Height = 19
Ctl3D = True
ParentCtl3D = False
TabOrder = 1
Text = ''
Alignment = taCenter
end
Salutations et bon codding!!!
Dugueclin.
 
查到这些资料,如何做成
 
你自己不是把源码发出来了?自己重新编译安装下不就OK了?
 
unit CDEdit;

interface

uses
SysUtils, Classes, Controls, StdCtrls;

type
TCDEdit = class(TEdit)
private
{ Déclarations privées }
FTextAlign: TAlignment;
FOnlyNumbers: boolean;
procedure SetOnlyNumbers(Value: boolean);
procedure SetTextAlign(Value: TAlignment);
protected
{ Déclarations protégées }
procedure CreateParams(var Params: TCreateParams); override;
public
{ Déclarations publiques }
constructor Create(AOwner: TComponent); override;
published
{ Déclarations publiées }
property OnlyNumbers: boolean read FOnlyNumbers write SetOnlyNumbers;
property TextAlignment: TAlignment read FTextAlign write SetTextAlign;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Exemples', [TCDEdit]);
end;

{ TCDEdit }

constructor TCDEdit.Create(AOwner: TComponent);
begin
inherited;
FTextAlign := taLeftJustify;
FOnlyNumbers := FALSE;
end;

procedure TCDEdit.CreateParams(var Params: TCreateParams);
const
Alignments: array[TAlignment] of Word = (ES_LEFT, ES_RIGHT, ES_CENTER);
begin
inherited CreateParams(Params);
Params.Style := Params.Style or Alignments[TextAlignment];
if OnlyNumbers then
Params.Style := Params.Style or ES_NUMBER
end;

procedure TCDEdit.SetOnlyNumbers(Value: boolean);
begin
if FOnlyNumbers <> Value thenbegin
FOnlyNumbers := Value;
RecreateWnd;
end;
end;

procedure TCDEdit.SetTextAlign(Value: TAlignment);
begin
if FTextAlign <> Value thenbegin
FTextAlign := Value;
RecreateWnd;
end;
end;

end.



将上面代码粘贴,保存成CDEdit.pas
然后再安装 Install Component
 
package CDEditVcl;

{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO ON}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$IMPLICITBUILD OFF}

requires
rtl,
vcl,
designide;

contains
CDEdit in 'CDEdit.pas';

end.

顺便将这个也粘贴成CDEditVcl.dpk,然后打开File-Open再Install
 
Alignments: array[TAlignment] of Word = (ES_LEFT, ES_RIGHT, ES_CENTER);

提示没有定义这三个ES_LEFT, ES_RIGHT, ES_CENTER
 
改一改,加上 Windows
uses
Windows, SysUtils, Classes, Controls, StdCtrls;
 
可以了,感谢kinneng
 
后退
顶部