1.好象在EDIT中没有什么属性可以使EDIT当中的文本内容显示在EDIT的中间.2.在窗口中放置三个'EDIT'要求在EDIT1中输入汉字,在EDIT2中显示其汉字对应的首字母,在DEIT3中显示其汉字首对应的五笔首个字母.
例如:在DEIT1中输入'我爱你'则在EDIT2中显示'WAN',在EDIT3中显示'QEW'.

解决方案 »

  1.   

    { TEsiEdit }
      TEsiEdit = class(TEdit)
      private
        FAlignment: TAlignment;
        procedure SetAlignment(const Value: TAlignment);
      protected
        procedure CreateParams(var Params: TCreateParams); override;
      public
        constructor Create(AOwner: TComponent); override;
      published
        property  Alignment: TAlignment read FAlignment write SetAlignment
          default taCenter;
      end;constructor TEsiEdit.Create(AOwner: TComponent);
    begin
      inherited;
      FAlignment := taCenter;
    end;procedure TEsiEdit.CreateParams(var Params: TCreateParams);
    begin
      inherited;
      case FAlignment of
        taCenter:
          Params.Style := Params.Style or ES_CENTER;
        taLeftJustify :
          Params.Style := Params.Style or ES_LEFT;
        taRightJustify:
          Params.Style := Params.Style or ES_RIGHT;
      end;
    end;procedure TEsiEdit.SetAlignment(const Value: TAlignment);
    begin
      FAlignment := Value;
      if Handle <> 0 then Perform(CM_RECREATEWND, 0, 0);
    end;可以使EDIT当中的文本内容显示在EDIT的中间.
      

  2.   

    1、参考vcl其他控件的实现方式2、拼音可以搜到,五笔没听说。。
      

  3.   

    1,显示中间的很不是很难吧, 取得你的EDIT的WIDTH值,然后取得你的每个汉字的WIDTH值(你可以估计,我以前见过这样的东西),剩下的就简单了。
    2,显示拼音首字母,很简单,一段函数,你调用就行了,网上到处有,你搜一下,一堆,至于五笔第一个字母,我不知道了。呵呵:) 希望你知道了,告诉我: [email protected]
      

  4.   

    呵呵,你可以调用setwindowslong的函数,这个函数可以设置textout的位置
      

  5.   

    给你一个返回拼音首字母的函数,这是我抄别人的
    function TCommF.GetPY(AHzStr: string): string;
    const
      ChinaCode: array[0..25, 0..1] of Integer = ((1601, 1636), (1637, 1832), (1833, 2077),
        (2078, 2273), (2274, 2301), (2302, 2432), (2433, 2593), (2594, 2786), (9999, 0000),
        (2787, 3105), (3106, 3211), (3212, 3471), (3472, 3634), (3635, 3722), (3723, 3729),
        (3730, 3857), (3858, 4026), (4027, 4085), (4086, 4389), (4390, 4557), (9999, 0000),
        (9999, 0000), (4558, 4683), (4684, 4924), (4925, 5248), (5249, 5589));
    var
      i, j, HzOrd: integer;
      Hz: string[2];
    begin
      result:= '';
      i := 1;
      while i <= Length(AHzStr) do
      begin
        if (AHzStr[i] >= #160) and (AHzStr[i + 1] >= #160) then
        begin
          HzOrd := (Ord(AHzStr[i]) - 160) * 100 + Ord(AHzStr[i + 1]) - 160;
          for j := 0 to 25 do
          begin
            if (HzOrd >= ChinaCode[j][0]) and (HzOrd <= ChinaCode[j][1]) then
            begin
              Result := Result + char(byte('A') + j);
              break;
            end;
          end;
          Inc(i);
        end
        else Result := Result + AHzStr[i];
        Inc(i);
      end;
    end;
    使用
    str:=GetPY('中华人民共和国')
      

  6.   

    SetWindowLong(Edit1.Handle, GWL_STYLE, GetWindowLong(Edit1.Handle, GWL_STYLE) or ES_CENTER);
    Edit1.Refresh;