- 小学一年级
- 201185
- 19
- 0
- 13 朵
- 16 个
- 20 个
- 0
- 2008-10-22
|
1#
t
T
发表于 2021-11-15 23:25
|
|只看楼主
水平一般,自己慢慢琢磨着用,献丑了,高手勿喷,只是分享下成果PC,生成小精灵方便开单,收竿、删除、关窗都会生成文本数据保存到本地C盘,也可以调出查询,直接连接打印机打印,到时文字提示也可音乐提示,很多功能添加了密码,防止有人手多乱按,代码零乱,大神勿喷!不懂怎么设置关窗退出程序提醒,没办法避免误关,也不知道有没最大化设置。欢迎大神指点!
- Declare Function PeekMessageA Lib "user32.dll" Alias "PeekMessageA"(ByVal 消息格式 As Any,ByVal 窗口句柄 As Long,ByVal 消息最小过滤值 As Long,ByVal 消息最大过滤值 As Long,ByVal 删除消息 As Long) As Long
- Declare Function LocalAlloc Lib "kernel32" Alias "LocalAlloc" (ByVal wOemChar As Long,ByVal wOmChar As Long) As Long
- Declare Function LocalFree Lib "kernel32" Alias "LocalAlloc" (ByVal hMem As Long) As Long
- Declare Function TranslateMessage Lib "user32.dll" Alias "TranslateMessage"(ByVal 消息结构 As Any) As Long
- Declare Function DispatchMessageA Lib "user32.dll" Alias "DispatchMessageA"(ByVal 消息结构 As Any) As Long
- Declare Function timeGetTime Lib "winmm.dll" () As Long
- Declare Function GetTickCount Lib "kernel32.dll" Alias "GetTickCount"() As Long
- Event Form1.Load
- Form1.TabControl1.Visible = False
- Form1.时间.Caption = Date
- //释放附件 打印插件
- PutAttachment ".\plugin", "*.dll"
- i = NOW
- Form1.Timer1.Interval = 1000 //设置定时器循环的间隔时间(单位:毫秒)
- End Event
- Event Form1.InputBox1.Change
- Form1.InputBox1.Text = Right(Form1.InputBox1.Text,2)
- End Event
- Event Form1.InputBox2.Change
- Form1.InputBox2.Text = Right(Form1.InputBox2.Text,2)
- End Event
- Event Form1.InputBox3.Change
- Form1.InputBox3.Text = Right(Form1.InputBox3.Text,2)
- End Event
- //根据定时周期执行事件
- Event Form1.Timer1.Timer
- Form1.Label16.Caption = i
- Form1.Label1.Caption = i//改变标签内容
- i=NOW+0.0000115740
- //统计竿数,够钟提示
- 竿数=Form1.Grid1.RowCount-2
- For m = 1 To Form1.Grid1.RowCount-2
- 结束=Form1.Grid1.GetItemText(m,3)
- 结束= TimeValue(结束)
- 背景颜色= "555fff"
- 字颜色= "fffff"
- If Time>结束 Then
- If "555FFF" = Form1.Grid1.GetItemBkColor(m, 3) Then
- Else
- Form1.Grid1.SetItemBkColor m,3,背景颜色
- Form1.Grid1.SetItemFgColor m,3,字颜色
- //判断选中情况
- If Form1.提示音.Value = 1 Then
- Call Plugin.Media.Play("C:\Areyouok.mp3")
- //播放路径("C:\Areyouok.mp3")音乐文件
- Else
- End If
- End If
- End If
- Next
- //以上是够钟提示
- End Event
- //开单
- Event Form1.Button1.Click
- 返回值 = Lib.窗口.弹出对话框("请确认信息是否正确,是否开单?",0,"警告",65)
- If 返回值=1 Then
- 类型 = Split(Form1.ComboBox1.List,"|")
- 费用 = Split(Form1.ComboBox2.List,"|")
- //从下拉框中获取文本内容,
- If 类型(Form1.ComboBox1.ListIndex)<> "" Then
- 种类=类型(Form1.ComboBox1.ListIndex)
- 竿费=费用(Form1.ComboBox2.ListIndex)
- If Form1.InputBox1.Text <> "" Then
- 钓位=Form1.InputBox1.Text
- If 钓位 < 10 Then
- 钓位="0"&钓位
- End If
- If Form1.InputBox2.Text <> "" Then
- 时=Form1.InputBox2.Text
- If Form1.InputBox3.Text <> "" Then
- 分= Form1.InputBox3.Text
- Hour 时
- Minute 分
- Second(0)
- 开竿时间=TimeValue(TimeSerial(时,分,秒))
- 结束时间=TimeSerial(时+4,分,秒)
- Form1.Grid1.InsertRow 1
- Form1.Grid1.SetItemText 1,0,种类
- Form1.Grid1.SetItemText 1,1,钓位
- Form1.Grid1.SetItemText 1,2,开竿时间
- Form1.Grid1.SetItemText 1,3,结束时间
- Form1.Grid1.SetItemText 1,4,竿费
- End If
- End If
- End If
- End If
- End If
- Form1.开竿时间.Caption = 开竿时间
- Form1.收竿时间.Caption = 结束时间
- Form1.钓位.Caption = 种类&钓位&"#"
-
-
- Form1.竿费.Caption = 竿费
- //开始打印
- Dim 验证
- 验证 = MsgBox("是否确定打印?", 49)
- If 验证 = 1 then
-
-
- Call Plugin.OfficeWork.PrintForm(form1.Hwnd,form1.Container1.Left,form1.Container1.Top,962,form1.Container1.Height+form1.Container1.Top)
- End If
- End Event
- //=============上面是录入资料代码====True================
- //统计竿数
- Event Form1.Button2.Click
- //获取到每一行的数据,然后通过eval命令相加
- 竿数=Form1.Grid1.RowCount-2
- 值 = 0
- 竿 = 0
- For m = 1 To Form1.Grid1.RowCount-2
- 值 = eval(值 + Form1.Grid1.GetItemText(m, 5))
- 竿 = eval(竿 + Form1.Grid1.GetItemText(m, 4))
- Next
- MessageBox "共:"&竿数&"条,"&"竿费共:"&竿&"元;"&"回鱼费共:"&值&"元。"
- End Event
- //全部收竿
- Event Form1.Button3.Click
- 返回值 = Lib.窗口.弹出对话框("请确认是否全部收竿?确定将会全部数据清空!",0,"警告",65)
- If 返回值=1 Then
- 密码 = (InputBox ("请输入解锁密码:"))
- If 密码=1988 Then
- //保存配置事件
- 竿数=Form1.Grid1.RowCount-2
- 值 = 0
- For m = 1 To Form1.Grid1.RowCount-2
- 值 = eval(值 + Form1.Grid1.GetItemText(m, 4))
- Next
- //获取到每一行的数据,然后通过eval命令相加
- 回鱼 = 0
- For m = 1 To Form1.Grid1.RowCount-2
- 回鱼 = eval(回鱼 + Form1.Grid1.GetItemText(m, 5))
- Next
- MsgBox Date&" 共 "&竿数&" 竿"&" 共"&值&"元"&"; 回鱼费共:"&回鱼&"元"
- For 竿数
- 类型=Form1.Grid1.GetItemText(1,0)&"*"
- 钓位=Form1.Grid1.GetItemText(1,1)&"#*"
- 开始=Form1.Grid1.GetItemText(1,2)&"*"
- 结束=Form1.Grid1.GetItemText(1,3)&"*"
- 费用=Form1.Grid1.GetItemText(1,4)&"*"
- 回鱼费=Form1.Grid1.GetItemText(1,5)&"*"
- Call Plugin.File.WriteFileEx("C:\开竿记录.txt", now&"*"&类型&钓位&开始&结束&费用&回鱼费)
- Form1.Grid1.DeleteRow 1
- Next
- //显示当前列表行数数量
- Else
- MsgBox "密码错误"
- End If
- End If
- End Event
- //下面是输入回鱼金额=======================================================================================================
- Event Form1.Grid1.DblClick
- Form1.Grid1.GetSelectedRange 行, 列, x1, y1
- 钓位=Form1.Grid1.GetItemText(行,1)
- 类型=Form1.Grid1.GetItemText(行,0)
- 回鱼费=Form1.Grid1.GetItemText(行,5)
- 竿费=Form1.Grid1.GetItemText(行,4)
- //下面是修改回鱼费用==================================================================================================
- If 列=5 Then
- If 回鱼费="" Then
- 返回值 = Lib.窗口.弹出对话框(类型&钓位&"#填入回鱼费用?",0,"警告",65)
- If 返回值=1 Then
- 回鱼费用 = (InputBox ("请输入回鱼金额:"))
- Form1.Grid1.SetItemText 行,5,回鱼费用
- Else
- End If
- Else
- 返回值 = Lib.窗口.弹出对话框("请确认是否选对?"&类型&钓位&"#已有回鱼费用了!",0,"警告",65)
- If 返回值=1 Then
- 密码 = (InputBox ("请输入解锁密码:"))
- If 密码=1988 Then
- 回鱼费用 = (InputBox ("请输入回鱼金额:"))
- Form1.Grid1.SetItemText 行,5,回鱼费用
- Else
- MsgBox "密码错误"
- End If
- End If
- End If
- Else
- If 列=4 Then
- //下面是修改竿费========================================================================================================================================
- If 竿费="" Then
- 返回值 = Lib.窗口.弹出对话框(类型&钓位&"#填入竿费?",0,"警告",65)
- If 返回值=1 Then
- 竿费 = (InputBox ("请输入竿费金额:"))
- Form1.Grid1.SetItemText 行,4,竿费
- Else
- End If
- Else
- 返回值 = Lib.窗口.弹出对话框("请确认是否选对?"&类型&钓位&"#要修改竿费吗?",0,"警告",65)
- If 返回值=1 Then
- 密码 = (InputBox ("请输入解锁密码:"))
- If 密码=1988 Then
- 竿费 = (InputBox ("请输入竿费金额:"))
- Form1.Grid1.SetItemText 行,4,竿费
- Else
- MsgBox "密码错误"
- End If
- End If
- End If
- Else
- End If
- End If
- End Event
- //获取到每一行的数据,然后通过eval命令相加
- //选表格特定行删去
- Event Form1.Button5.Click
- Form1.Grid1.GetSelectedRange 行, 列, x1, y1
- 钓位=Form1.Grid1.GetItemText(行,1)
- 类型=Form1.Grid1.GetItemText(行,0)
- 返回值 = Lib.窗口.弹出对话框("请确认是否需要删除?"&类型&钓位&"#钓位",0,"警告",65)
- If 返回值=1 Then
- 密码 = (InputBox ("请输入解锁密码:"))
- If 密码=1988 Then
- 类型=Form1.Grid1.GetItemText(行,0)&"*"
- 钓位=Form1.Grid1.GetItemText(行,1)&"#*"
- 开始=Form1.Grid1.GetItemText(行,2)&"*"
- 结束=Form1.Grid1.GetItemText(行,3)&"*"
- 费用=Form1.Grid1.GetItemText(行,4)&"*"
- 回鱼费=Form1.Grid1.GetItemText(行,5)&"*"
- Call Plugin.File.WriteFileEx("C:\删除记录.txt", now&"*"&类型&钓位&开始&结束&费用&回鱼费)
- Form1.Grid1.DeleteRow 行
- Else
- MsgBox "密码错误"
- End If
- End If
- End Event
-
- Event Form1.Button6.Click
- //开始打印
- Dim 验证
- 验证 = MsgBox("是否确定打印?", 49)
- If 验证 = 1 then
-
-
- Call Plugin.OfficeWork.PrintForm(form1.Hwnd,form1.Container1.Left,form1.Container1.Top,962,form1.Container1.Height+form1.Container1.Top)
- End If
- End Event
- //选表格特定行数据打印
- Event Form1.Grid1.Click
- Form1.Grid1.GetSelectedRange 行, 列, x1, y1
- 钓位=Form1.Grid1.GetItemText(行,1)
- 类型=Form1.Grid1.GetItemText(行,0)
- 钓位=Form1.Grid1.GetItemText(行,1)
- 开始=Form1.Grid1.GetItemText(行,2)
- 结束=Form1.Grid1.GetItemText(行,3)
- 竿费=Form1.Grid1.GetItemText(行,4)
- Form1.开竿时间.Caption = 开始
- Form1.收竿时间.Caption = 结束
- Form1.钓位.Caption = 类型&钓位&"#"
- Form1.竿费.Caption = 竿费
- End Event
- //关闭窗口
- Event Form1.UnLoad
- 竿数=Form1.Grid1.RowCount-2
- 值 = 0
- If 竿数>0 Then
- // Call Plugin.File.DeleteFile("C:\关窗记录.txt")
- //获取到每一行的数据,然后通过eval命令相加
- For 竿数
- 类型=Form1.Grid1.GetItemText(1,0)&"*"
- 钓位=Form1.Grid1.GetItemText(1,1)&"*"
- 开始=Form1.Grid1.GetItemText(1,2)&"*"
- 结束=Form1.Grid1.GetItemText(1,3)&"*"
- 费用=Form1.Grid1.GetItemText(1,4)&"*"
- 回鱼费=Form1.Grid1.GetItemText(1,5)&"*"
- Call Plugin.File.WriteFileEx("C:\关窗记录.txt", now&"*"&类型&钓位&开始&结束&费用&回鱼费)
- Form1.Grid1.DeleteRow 1
- Next
- End If
- End Event
- Event Form1.停止播放.Click
- Call Plugin.Media.Stop()
- End Event
- //===================================数据查询页==================================================
- Event Form1.导入.Click
- 密码 = (InputBox ("请输入解锁密码:"))
- If 密码=1988 Then
- //读取配置事件
- //下面这句是向目标文件("C:\Config.txt")读出文本内容到变量(Text)
- wenjian = Plugin.File.SelectFile()
- If wenjian = "" Then
- Else
- //下面这句是得到文本内容
- Text = Plugin.File.ReadFileEx (wenjian)
- 开始日期 = Form1.开始日期.Text
- 结束日期 = Form1.结束日期.Text
- //下面这句是索取指定文本位置
- 位置1=InStr(Text,开始日期)
- 位置2=InStrRev(Text,结束日期)
- 日期字数 = Len(开始日期)
- 字符=Mid(Text,位置1,位置2+70)
- dim 一格内容
- Dim 一行内容
- //下面这句是文本内容分组
- 一行内容 = Split(字符, "|", -1, 1)
- ' MyString(0) 包含"VBScript"。
- ' MyString(1) 包含"is"。
- ' MyString(2) 包含 "fun!"。
- 数=UBound(一行内容)
- If 数>0 Then
- i=0
- For 数
- //下面这句是得到文本内容
- Form1.Grid2.InsertRow 1
- 一格内容= Split(一行内容(i), "*", -1, 1)
- 格=UBound(一格内容)
- g=0
- For 格
- Form1.Grid2.SetItemText 1,g,一格内容(g)
- //上面这一句表格还是显示不出来,哪里错了????????????????????????????????
- g= g + 1
- Next
- i = i + 1
- Next
- End If
- End If
- End If
- // Call Plugin.File.DeleteFile("C:\关窗记录.txt")
- End Event
- Event Form1.清除数据.Click
- 返回值 = Lib.窗口.弹出对话框("请确认是否全部收竿?确定将会全部数据清空!",0,"警告",65)
- If 返回值=1 Then
- //保存配置事件
- 竿数=Form1.Grid2.RowCount-2
- 值 = 0
- For 竿数
- Form1.Grid2.DeleteRow 1
- Next
- //显示当前列表行数数量
- End If
- End Event
- Event Form1.数据统计.Click
- //获取到每一行的数据,然后通过eval命令相加
- 竿数=Form1.Grid2.RowCount-2
- 值 = 0
- 竿 = 0
- For m = 1 To Form1.Grid2.RowCount-2
- 值 = eval(值 + Form1.Grid2.GetItemText(m, 6))
- 竿 = eval(竿 + Form1.Grid2.GetItemText(m, 5))
- Next
- MessageBox "共:"&竿数&"条,"&"竿费共:"&竿&"元;"&"回鱼费共:"&值&"元。"
- End Event
- //下面是登陆界面操作代码
- Event Form1.登录.Click
- 密码 = (InputBox ("请输入解锁密码:"))
- If 密码=1988 Then
- Form1.Container3.Visible = False
- Form1.TabControl1.Visible = True
- Else
- MessageBox "密码错误"
- End If
- End Event
- Event Form1.隐藏.Click
- Form1.TabControl1.Visible = False
- Form1.Container3.Visible =True
- End Event
复制代码
点评
果壳王子
钓鱼达人
发表于 2021/11/17 12:12:33
|