Arsip: Posisi Alligment Center di TEDIT

 
user image
more 14 years ago

DeulleDo-X

Salam Delphi.... Ia langsung aja, gimana yah caranya membuat TEDIT.text posisi textnya selalu ke ceter
user image
more 13 years ago

p2bf

saya dapet dari buku... tapi cara penggunaannya lom ngerti. mungkin akang dan teteh lainnya bisa menambahkan
type
  TForm1 = class(TForm)
  private
    { private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
  FAlignment: TAlignment;
implementation
{$R *.dfm}
type TEditAlignment = class(TCustomEdit)
  procedure CreateParams(var Params: TCreateParams);
end;
procedure TEditAlignment.CreateParams(var Params: TCreateParams);
const
  Alignments: array[TAlignment] of Longint = (ES_LEFT,ES_RIGHT,ES_CENTER);
begin
  inherited CreateParams(Params);
  Params.Style := Params.Style or Alignments[FAlignment];
end;
user image
more 13 years ago

ivan

type
  TEdit = class(StdCtrls.TEdit)
  private
   FAlignment: TAlignment;
   procedure SetAlignment(Value: TAlignment);
  protected
   procedure CreateParams(var Params: TCreateParams); override;
  public
   property Alignment: TAlignment read FAlignment write SetAlignment;
  end;
type
  TForm1 = class(TForm)
  Edit1: TEdit;
  procedure FormCreate(Sender: TObject);
  private
    { private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TEdit.CreateParams(var Params: TCreateParams);
const
 Alignment: Array[Boolean, TAlignment] of DWORD =
     ((ES_LEFT, ES_RIGHT, ES_CENTER), (ES_RIGHT, ES_LEFT, ES_CENTER));
Begin
 inherited CreateParams(Params);
 with Params do
  Style := Style or Alignment[UseRightToLeftAlignment, FAlignment];
end;
procedure TEdit.SetAlignment(Value: TAlignment);
begin
 if FAlignment <> Value then
 begin
   FAlignment := Value;
   RecreateWnd;
 end;
end;
procedure TForm.FormCreate(Sender: TObject);
begin
  Edit1.Alignment:= taCenter;
end;
user image
more 13 years ago

eksant

untuk beberapa fungsi memang spt code di atas, hmm.. no comment wae
more ...
  • Pages:
  • 1
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com