在MSFLEXGRID控件的EnterCell,LeaveCell添加代码,设置CheckBox的位置,使它正好盖住单元格。下面的程序用的是TextBox,道理是一样的。 Private Sub MSFlexGrid2_EnterCell() If newtemplet_Flag = True Then Text8.Top = MSFlexGrid2.CellTop + MSFlexGrid2.Top + Frame3.Top Text8.Left = MSFlexGrid2.CellLeft + MSFlexGrid2.Left + Frame3.Left Text8.width = MSFlexGrid2.CellWidth - 2 * Screen.TwipsPerPixelX Text8.Height = MSFlexGrid2.CellHeight - 2 * Screen.TwipsPerPixelY Text8.Text = MSFlexGrid2.Text Text8.Visible = True Text8.ZOrder 0 Text8.SetFocus End If End Sub Private Sub MSFlexGrid2_LeaveCell() If newtemplet_Flag = True Then If Text8.Visible = True Then MSFlexGrid2.Text = Text8.Text If MSFlexGrid2.TextMatrix(0, MSFlexGrid2.Col) = "属性名" Then MSFlexGrid2.CellForeColor = vbBlue End If Text8.Visible = False End If End If End Sub
Private Sub MSFlexGrid2_EnterCell()
If newtemplet_Flag = True Then
Text8.Top = MSFlexGrid2.CellTop + MSFlexGrid2.Top + Frame3.Top
Text8.Left = MSFlexGrid2.CellLeft + MSFlexGrid2.Left + Frame3.Left
Text8.width = MSFlexGrid2.CellWidth - 2 * Screen.TwipsPerPixelX
Text8.Height = MSFlexGrid2.CellHeight - 2 * Screen.TwipsPerPixelY
Text8.Text = MSFlexGrid2.Text
Text8.Visible = True
Text8.ZOrder 0
Text8.SetFocus
End If
End Sub
Private Sub MSFlexGrid2_LeaveCell()
If newtemplet_Flag = True Then
If Text8.Visible = True Then
MSFlexGrid2.Text = Text8.Text
If MSFlexGrid2.TextMatrix(0, MSFlexGrid2.Col) = "属性名" Then
MSFlexGrid2.CellForeColor = vbBlue
End If
Text8.Visible = False
End If
End If
End Sub