前两句代码似乎没有必要,因为你一点击,当前的行列就已经决定了。
请参考:
Public Sub 设置Text1()
'Exit Sub
   If Text1.Visible Then
      FGrid.TextArray(CurrentRow * FGrid.Cols + CurrentCol) = Text1
      Call 网格存盘(CurrentRow, CurrentCol)
   End If
   If FGrid.Row < FGrid.TopRow Or _
      FGrid.Row > FGrid.TopRow + EditLines Then
      Text1.Visible = False
      Exit Sub
   End If
   
   Dim tx As Integer
   Dim ty As Integer
   Dim c As Integer
   Text1.Visible = False
   Text1.Height = FGrid.RowHeight(FGrid.Row) - (Screen.TwipsPerPixelY) - 30 ' * 2)
   Text1.Width = FGrid.ColWidth(FGrid.Col) - (Screen.TwipsPerPixelX) - 60 ' * 2)
   tx = FGrid.left + FGrid.ColWidth(0) + Screen.TwipsPerPixelX * 3 + 45
   For c = FGrid.LeftCol To FGrid.Col - 1
      tx = tx + FGrid.ColWidth(c)
   Next c
   
   ty = FGrid.top + FGrid.RowHeight(0) + Screen.TwipsPerPixelY * 3 + 15 '2
   For c = FGrid.TopRow To FGrid.Row - 1
      ty = ty + FGrid.RowHeight(c)
   Next c
   Text1.left = tx
   Text1.top = ty
   Text1.ZOrder
   Text1.ShowWhatsThis
   Text1 = FGrid.Text
   Text1.BackColor = QBColor(14)
   If FGrid.Col < FGrid.LeftCol Then
      Text1.Visible = False
      Exit Sub
   End If
   If FGrid.Row < FGrid.TopRow Or _
      FGrid.Row > FGrid.TopRow + EditLines Then
      Text1.Visible = False
      Exit Sub
      
   End If
   If FGrid.CellLeft + FGrid.CellWidth > FGrid.Width And _
      FGrid.CellLeft < FGrid.Width Then
      FGrid.LeftCol = FGrid.LeftCol + 1
   ElseIf FGrid.CellLeft + FGrid.CellWidth > FGrid.Width Then
      Text1.Visible = False
      Exit Sub
   End If
   
   Text1.Visible = True
   CurrentRow = FGrid.Row
   CurrentCol = FGrid.Col
   If Visible Then Text1.SetFocusEnd Sub

解决方案 »

  1.   

         刚开始txtDetails.visible=false
        flxGrid.Row = flxGrid.MouseRow
        flxGrid.Col = flxGrid.MouseCol
        '这句错txtDetails.Height = flxGrid.CellHeight / Screen.TwipsPerPixelX
        txtDetails.Height=flxGrid.CellHeight '改正
        '这句错txtDetails.Width = flxGrid.CellWidth / Screen.TwipsPerPixelY
        txtDetails.Width=flxGrid.CellWidth   '改正
        txtDetails.Visible = True
        '这句错txtDetails.Top = flxGrid.CellTop / Screen.TwipsPerPixelY
        txtDetails.Top=flxGrid.CellTop + flxGrid.Top '改正
        '这句错txtDetails.Left = flxGrid.CellLeft / Screen.TwipsPerPixelX
        txtDetails.Left=flxGrid.CellLeft + flxGrid.Left '改正为什么文本框总是不能显示在鼠标所指的那个单元格上面,是me.scalemode的问题吗?谢了! 
      

  2.   

    你是否把FORM的scalemode设为PIXEL了?
    这样是没有意义的,快设回来。然后按照superlight的办法处理。如果还是不对,有偏移,
    那么应该就是你的FLEXGRID和TEXTBOX不在同一容器内的问题了。