📄 frmsite.frm
字号:
keys(0) = "Control+A"
.ShortCuts = keys
.ToolTipText = "增加座位"
.CaptionPosition = ddCPBelow
.Style = ddSIconText
End With
Set t = Abar.Tools.Add(GetUniqueToolID(), "m_modify")
With t
.Caption = "修改"
.SetPicture ddITNormal, LoadResPicture(200, vbResBitmap)
.ControlType = ddTTButton
keys(0) = "Control+E"
.ShortCuts = keys
.ToolTipText = "修改座位信息"
.CaptionPosition = ddCPBelow
.Style = ddSIconText
End With
Set t = Abar.Tools.Add(GetUniqueToolID(), "m_del")
With t
.Caption = "删除"
.SetPicture ddITNormal, LoadResPicture(102, vbResBitmap)
.ControlType = ddTTButton
keys(0) = "Control+D"
.ShortCuts = keys
.ToolTipText = "删除座位"
.CaptionPosition = ddCPBelow
.Style = ddSIconText
End With
Set t = Abar.Tools.Add(GetUniqueToolID(), "m_print")
With t
.Caption = "打印"
.SetPicture ddITNormal, LoadResPicture(106, vbResBitmap)
.ControlType = ddTTButton
keys(0) = "Control+Q"
.ShortCuts = keys
.ToolTipText = "打印"
.CaptionPosition = ddCPBelow
.Style = ddSIconText
End With
Set t = Abar.Tools.Add(GetUniqueToolID(), "m_exit")
With t
.Caption = "关闭": Tool.Category = "m_sys"
.SetPicture ddITNormal, LoadResPicture(103, vbResBitmap)
.ControlType = ddTTButton
keys(0) = "Control+C"
.ShortCuts = keys
.ToolTipText = "关闭本窗口"
.CaptionPosition = ddCPBelow
.Style = ddSIconText
End With
With b.Tools
.Insert .Count, Abar.Tools("m_add")
.Insert .Count, Abar.Tools("m_del")
.Insert .Count, Abar.Tools("m_modify")
.Insert .Count, Abar.Tools("Separator")
.Insert .Count, Abar.Tools("m_print")
.Insert .Count, Abar.Tools("Separator")
.Insert .Count, Abar.Tools("m_exit")
End With
Abar.RecalcLayout
Abar.Refresh
Set dbs = OpenDatabase(ConData, False, False, Constr)
Set rst = dbs.OpenRecordset("Select sitename,PersonerN,sitepay From site", dbOpenDynaset)
Set siteData.Recordset = rst
fpsp.OperationMode = OperationModeRow
fpsp.SelBackColor = &HFFC0C0
InitGrid
Debug.Print Me.Width
End Sub
Private Sub InitGrid()
With rst
If .RecordCount > 0 Then
.MoveLast
.MoveFirst
Tname.Text = !siteName
Trs.Text = !PersonerN
Tsp.Text = !SitePay
Else
VSrs.Value = 2
VSrs.Value = 2
End If
End With
With fpsp
.UnitType = UnitTypeTwips
.RowHeight(0) = 500
.MaxRows = rst.RecordCount
.MaxCols = rst.Fields.Count
.Row = 0
.Row2 = .MaxRows
.Col = 1
.Col2 = .MaxCols
.BlockMode = True
.Protect = True
.FontName = "宋体"
.FontSize = "9.25"
.Lock = True
.BlockMode = False
.Row = 0
.Row2 = 0
.Col = 1
.Col2 = .MaxCols
.Clip = "座位名称" & Chr(9) & "容纳人数" & Chr(9) & "台位费"
.ColWidth(1) = 1200
.ColWidth(2) = 1000
.ColWidth(3) = 1000
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
SaveFormSet Me
End Sub
Private Sub ccancle_Click()
Fredit.Enabled = False
fpsp.Enabled = True
With fpsp
.Row = .ActiveRow
.Col = 1
Tname.Text = fpsp.Text
.Col = 2
Trs.Text = fpsp.Text
.Col = 3
Tsp.Text = .Value
End With
Abar.Tools("m_add").Enabled = True
Abar.Tools("m_modify").Enabled = True
Abar.Tools("m_del").Enabled = True
Abar.Tools("m_print").Enabled = True
End Sub
Private Sub cok_Click()
On Error GoTo er
If CheckOK() Then
If CurrOp = "add" Then
sqlstr = "Insert into site (SiteName,PersonerN,SitePay) values('" & Trim(Tname.Text) & "'," & Trim(Trs.Text) & "," & Trim(Tsp.Text) & ")"
dbs.Execute sqlstr
Else
fpsp.Row = fpsp.ActiveRow
fpsp.Col = 1
t = fpsp.Text
dbs.Execute "update site set SiteName ='" & Tname.Text & "'" & _
",PersonerN=" & Trs.Text & _
",SitePay=" & Tsp.Text & " where sitename = '" & t & "';"
End If
rst.Requery
InitGrid
Fredit.Enabled = False
fpsp.Enabled = True
Abar.Tools("m_add").Enabled = True
Abar.Tools("m_modify").Enabled = True
Abar.Tools("m_del").Enabled = True
Abar.Tools("m_print").Enabled = True
End If
Exit Sub
er:
errorHandle ""
Fredit.Enabled = False
fpsp.Enabled = True
Abar.Tools("m_add").Enabled = True
Abar.Tools("m_modify").Enabled = True
Abar.Tools("m_del").Enabled = True
Abar.Tools("m_print").Enabled = True
End Sub
Private Sub fpsp_LeaveRow(ByVal Row As Long, ByVal RowWasLast As Boolean, ByVal RowChanged As Boolean, ByVal AllCellsHaveData As Boolean, ByVal NewRow As Long, ByVal NewRowIsLast As Long, Cancel As Boolean)
With fpsp
.Row = NewRow
.Col = 1
Tname.Text = .Text
.Col = 2
Trs.Text = .Text
.Col = 3
Tsp.Text = .Value
End With
End Sub
Private Sub Pic_Resize()
On Error Resume Next
fpsp.Left = 0
fpsp.Top = 0
fpsp.Height = Pic.Height - 50
Fredit.Height = fpsp.Height - Fredit.Top
Fredit.Left = Pic.Width - Fredit.Width - 100
fpsp.Width = Fredit.Left - 50
cok.Top = Fredit.Top + Fredit.Height - 350 - cok.Height
ccancle.Top = cok.Top
End Sub
Private Sub Trs_Change()
End Sub
Private Sub Tsp_Validate(Cancel As Boolean)
If Not IsNumeric(Tsp.Text) Then
MsgBox Tsp.Text & "不是有效的台位费,‘台位费’必须为数字!", vbCritical, "提示"
Cancel = True
Tsp.SetFocus
End If
End Sub
Private Sub VSrs_Change()
Trs.Text = VSrs.Value
End Sub
Private Function CheckOK() As Boolean
CheckOK = False
If Len(Tname.Text) > 0 Then
If Not IsNumeric(Tsp.Text) Then
MsgBox Tsp.Text & "不是有效的台位费,‘台位费’必须为数字!", vbCritical, "提示"
Tsp.SetFocus
Exit Function
End If
Else
MsgBox Te.Text & "座位名称不能为空!", vbCritical, "提示"
Tname.SetFocus
Exit Function
End If
CheckOK = True
End Function
Private Sub Tname_GotFocus()
SendKeys "{Home}+{End}"
End Sub
Private Sub Tsp_GotFocus()
SendKeys "{Home}+{End}"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -