我需要将多行功能添加到我的TMaskEdit中,我可以找到负责此功能的属性。任何帮助,将不胜感激。

最佳答案

您可以制作TMaskEdit多行,通过覆盖ES_MULTILINE方法将CreateParams样式添加到控件中。像这样

type

  TMaskEdit = class(Vcl.Mask.TMaskEdit)
  protected
    { Protected declarations }
    procedure CreateParams(var Params: TCreateParams); override;
  end;

  TForm30 = class(TForm)
    MaskEdit1: TMaskEdit;
    Edit1: TEdit;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form30: TForm30;

implementation

{$R *.dfm}


procedure TMaskEdit.CreateParams(var Params: TCreateParams);
const Alignments: array[TAlignment] of Longint =
      (ES_LEFT, ES_RIGHT, ES_CENTER);
begin
  inherited CreateParams(Params);
                                  //Multiline        //scrollbars
  Params.Style := Params.Style or ES_MULTILINE or WS_HSCROLL or WS_VSCROLL;
end;

procedure TForm30.FormCreate(Sender: TObject);
begin
 MaskEdit1.Height:= 250;
 MaskEdit1.AutoSize:= False;
end;

关于forms - 如何在Delphi XE2中使TMaskEdit多行编辑,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29684679/

10-12 13:13