Board logo

Subject: [BUG]TCnEdit [Print This Page]

Author: jAmEs_    Time: 2009-7-4 10:06     Subject: [BUG]TCnEdit

TCnEdit.Alignment = taRightJustify時,處理不理想:
1.得到焦點時,在左邊顯示,此時輸入1個字符馬上就變到右邊顯示了
2.得到焦點時,在左邊顯示,但是失去焦點時,有時不會還原到右邊
Author: jAmEs_    Time: 2009-7-4 10:21

粗略解決一下:

DoExit
begin
  ...
  //jAmEs_, 04/07/2009, Begin
  Invalidate;
  //jAmEs_, 04/07/2009, End
end;

WMPaint
begin
  ...
        //画文字
        MArgins := GetTextMArgins;
        //jAmEs_, 04/07/2009, Begin
        if Focused then
          Left := MArgins.X
        else
          case FAlignment of
            taLeftJustify: Left := MArgins.X;
            tArightJustify: Left := ClientWidth - TextWidth(S) - MArgins.X - 1;
          else
            Left := (ClientWidth - TextWidth(S)) div 2;
          end;
        //jAmEs_, 04/07/2009, End
        TextRect(R, Left, MArgins.Y, S);

        if (FLinkStyle <> lsNone) then   //画按钮
  ...
end;
Author: Passion    Time: 2009-7-4 23:41

感谢指出,已修正并提交至SVN。




Welcome to CnPack Forum (http://bbs.cnpack.org/) Powered by Discuz! 5.0.0