如何让Edit框中的字体靠右显示?

解决方案 »

  1.   

    //点击后左右对齐切换
    procedure TForm1.ButtonClick(Sender: TObject);
    var
      Style: DWORD;
    begin
      Style := GetWindowLong(Edit1.Handle, GWL_STYLE);
      if (Style and ES_RIGHT) = ES_RIGHT then
        Dec(Style, ES_RIGHT) 
      else
        Style := Style + ES_RIGHT;
      SetWindowLong(Edit1.Handle, GWL_STYLE, Style);
      Edit1.Invalidate;
    end;
      

  2.   

    SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_CENTER);
    SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_RIGHT);
      

  3.   

    Kshape([伟大的大伟!]) 高手