是不是没有一个GRID控件支持鼠标右键菜单的?
例如复制、粘贴等。其实我也只要一个复制,就是列出内容以后想复制一个单元格的内容又不想改变里面的数据,怎么办? 问题点数:20、回复次数:2Top
1 楼BigRichBigNoble(大富大贵)回复于 2002-06-01 00:09:03 得分 20
可以用TEXTBOX的右键菜单.
在窗体上追加一个名为grdDataList的MSFlexGrid,和一个名为txtInput4Grid,无边框,背景色为白色的TEXTBOX.拷贝以下代码,你试试看.
Option Explicit
Dim intFocusRow As Integer
Dim intFocusCol As Integer
Private Sub Form_Load()
txtInput4Grid.Visible = False
End Sub
Private Sub grdDataList_DblClick()
txtInput4Grid.Text = grdDataList.TextMatrix(grdDataList.Row, grdDataList.Col)
txtInput4Grid.Left = grdDataList.CellLeft + grdDataList.Left + 40
txtInput4Grid.Top = grdDataList.CellTop + grdDataList.Top + 20
txtInput4Grid.Height = grdDataList.CellHeight - 20
txtInput4Grid.Width = grdDataList.CellWidth - 60
txtInput4Grid.Visible = True
txtInput4Grid.SetFocus
txtInput4Grid.SelStart = 0
txtInput4Grid.SelLength = Len(txtInput4Grid.Text)
intFocusRow = grdDataList.Row
intFocusCol = grdDataList.Col
End Sub
Private Sub grdDataList_Scroll()
grdDataList.SetFocus
End Sub
Private Sub txtInput4Grid_LostFocus()
txtInput4Grid.Visible = False
'如果你不想更改GRID的内容,把以下代码注释.
grdDataList.TextMatrix(intFocusRow, intFocusCol) = txtInput4Grid.Text
End Sub
Top
2 楼m_pMain(刀剑笑)回复于 2002-06-02 23:37:07 得分 0
这个办法实在妙!谢谢你了!有空加我QQ:1197576Top




