FarPoint Spread如何像EXCEL一样显示单元格的批注

EXCEL如果对一个单元格进行了批注后,点击单元格时,会自动显示批注信息!

对于FarPoint Spread控件也可以实现类似的功能,需要结合控件的EnterCell,LeaveCell两个事件!EnterCell是单元格具有焦点时,LeavelCell是单元格失去焦点时引发的事件

代码如下:

 

''' <summary>
''' 单元格有焦点时
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub FpSpread1_EnterCell(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.EnterCellEventArgs) Handles FpSpread1.EnterCell
    If Not Me.FpSpread1.ActiveSheet.Cells(e.Row, e.Column).Note Is Nothing _
        And Me.FpSpread1.ActiveSheet.Cells(e.Row, e.Column).Note.Length > 0 Then
        Me.FpSpread1.ActiveSheet.Cells(e.Row, e.Column).NoteStyle = FarPoint.Win.Spread.NoteStyle.StickyNote
    End If
End Sub
''' <summary>
''' 单元格失去焦点时
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub FpSpread1_LeaveCell(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.LeaveCellEventArgs) Handles FpSpread1.LeaveCell
    If Not Me.FpSpread1.ActiveSheet.Cells(e.Row, e.Column).Note Is Nothing _
                And Me.FpSpread1.ActiveSheet.Cells(e.Row, e.Column).Note.Length > 0 Then
        Me.FpSpread1.ActiveSheet.Cells(e.Row, e.Column).NoteStyle = FarPoint.Win.Spread.NoteStyle.PopupNote
    End If
End Sub

你可能感兴趣的:(Spread)