在GRID表或EDIT中有的字段不能完全显示出来,我想做的是把移到相应位置,就可以把完整的字段内容显示出来,请问各位大侠有没有高招!谢谢

解决方案 »

  1.   

    procedure TForm1.Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      Edit1.Hint := Edit1.Text;
    end;
    Edit1的showHint 设为true
      

  2.   

    meiqingsong(阿飛) 你的方法可以,但如果字段内容没有超出EDIT的显示范围就不需要显示,怎样判断
    还有GRID表中的显示怎么实现?
    大家帮忙啊
      

  3.   

    主要是在GRID表中怎么实现把显示不完整的字段内空显示出来,并且判断如果字段内空没有超出GRID表的范围则不用提示! 能解决者本人另开帖加分!
      

  4.   

    -------------------------------------------------------------------------
    StringGrid
    //--------
    procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
      X, Y: Integer);
    var
      i, j: Integer;
    begin
      for i := 0 to StringGrid1.ColCount -1 do
        for j := 0 to StringGrid1.RowCount -1 do
      if (StringGrid1.CellRect(i,j).Left < x ) and (StringGrid1.CellRect(i,j).Right > x )
        and (StringGrid1.CellRect(i,j).Top < y) and (StringGrid1.CellRect(i,j).Bottom 
    > y )
        and (StringGrid1.Font.PixelsPerInch * Length(StringGrid1.Cells[i,j]) > StringGrid1.ColWidths[i])then
      StringGrid1.Hint := StringGrid1.Cells[i,j]
    end;--------------------------------------------------------------------------
    Edit
    //----
    procedure TForm1.Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      if(Edit1.Font.PixelsPerInch * Length(Edit1.Text) > Edit1.Width)then
        Edit1.Hint := Edit1.Text;
    end;
      

  5.   

    Edit
    //----
    procedure TForm1.Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      if(Edit1.Font.PixelsPerInch * Length(Edit1.Text) > Edit1.Width)then
        Edit1.Hint := Edit1.Text;
    end;
      

  6.   

    修改
    procedure TForm1.Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      Edit1.Hint := '';
      if(Edit1.Font.PixelsPerInch * Length(Edit1.Text) div 15 > Edit1.Width)then
      begin
        Edit1.Hint := Edit1.Text;
      end;
    end;procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
      X, Y: Integer);
    var
      i, j: Integer;
    begin
      StringGrid1.Hint := '';
      for i := 0 to StringGrid1.ColCount -1 do
        for j := 0 to StringGrid1.RowCount -1 do
      if (StringGrid1.CellRect(i,j).Left < x ) and (StringGrid1.CellRect(i,j).Right > x )
        and (StringGrid1.CellRect(i,j).Top < y) and (StringGrid1.CellRect(i,j).Bottom > y )
        and (StringGrid1.Font.PixelsPerInch * Length(StringGrid1.Cells[i,j]) div 15 > StringGrid1.ColWidths[i])then
      StringGrid1.Hint := StringGrid1.Cells[i,j]
    end;
      

  7.   

    好请 meiqingsong(阿飛) 关注加分,谢谢