前两句代码似乎没有必要,因为你一点击,当前的行列就已经决定了。
请参考:
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
请参考:
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
解决方案 »
- select data from combobox
- MSHflexgrid控件的列颜色及某行(满足某条件)颜色如何设置?
- 应用程序自动更新问题,请高手解答
- MSFlexGrid控件的用法???
- 想得到跟随鼠标的悬浮窗口
- 请问VB怎么区分中英文?
- 请问各位大哥在form加载的时候我把数据库的内容逐一加载上combo里面怎么说我with块未付值出错的
- 急于请教!mschart问题
- 关于MSFLEX
- 我刚刚在网上下了一个activereport 1.1和它的注册机。但不小心把网址给忘记了。好东西应该大家分享。所以我准备送给大家!!!不要钱。
- 哪里有MSDN集合下载啊?
- Inet1控件问题!50分奉送(回答以前的问题-用Inet1控件做ftp下载问题,急!!!,分照送!)
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的问题吗?谢了!
这样是没有意义的,快设回来。然后按照superlight的办法处理。如果还是不对,有偏移,
那么应该就是你的FLEXGRID和TEXTBOX不在同一容器内的问题了。