'***************************************************************************************
'  功能：“返回”按钮按下时恢复主窗口
'***************************************************************************************
Private Sub C返回_Click()

If C返回.Caption = "返回" Then
    bCellDataModified = False
'   窗体关闭时清除数据修改标志
    frmMain.Enabled = True
    Unload Me
Else
    If C插入.Caption = "保存" Then
        Cell1.DoDeleteRow CurrentRow, 1
    End If
    
    If C修改.Caption = "保存" Then
        Cell2.DoCopyArea 2, 0, 4, 0
        Cell1.DoPaste 2, CurrentRow, True
        Cell1.DoSetCellReadOnly 0, CurrentRow, True
        Cell1.DoSetCellReadOnly 1, CurrentRow, True
        Cell1.DoSetCellReadOnly 2, CurrentRow, True
        Cell1.DoSetCellReadOnly 3, CurrentRow, True
        Cell1.DoSetCellReadOnly 4, CurrentRow, True
        Cell1.DoRedrawRange 0, CurrentRow, 4, CurrentRow
    End If
    
    If C删除.Caption = "删除确定" Then
        Cell1.DoSetCell3DState 0, CurrentRow, 0
        Cell1.DoSetCell3DState 1, CurrentRow, 0
        Cell1.DoSetCell3DState 2, CurrentRow, 0
        Cell1.DoSetCell3DState 3, CurrentRow, 0
        Cell1.DoSetCell3DState 4, CurrentRow, 0
        Cell1.DoRedrawRange 0, CurrentRow, 4, CurrentRow
    End If
    
    C插入.Caption = "插入"
    C修改.Caption = "修改"
    C删除.Caption = "删除"
    C返回.Caption = "返回"

    C插入.Enabled = True
    C修改.Enabled = True
    C删除.Enabled = True
    C返回.Enabled = True
End If
End Sub


