📄 frmdocument.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "mswinsck.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "mshflxgd.ocx"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "tabctl32.ocx"
Begin VB.Form frmDocument
Caption = "frmDocument"
ClientHeight = 5985
ClientLeft = 5055
ClientTop = 3510
ClientWidth = 7545
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5985
ScaleWidth = 7545
Begin VB.CommandButton prev
Caption = "prev"
Enabled = 0 'False
Height = 300
Left = 1320
TabIndex = 6
Top = 5400
Width = 615
End
Begin VB.CommandButton next
Caption = "next"
Enabled = 0 'False
Height = 300
Left = 2280
TabIndex = 5
Top = 5400
Width = 615
End
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 300
Left = 1920
TabIndex = 4
Text = "0"
Top = 5400
Width = 375
End
Begin VB.TextBox Text2
Height = 1335
Left = 3240
MultiLine = -1 'True
TabIndex = 3
Top = 240
Visible = 0 'False
Width = 3135
End
Begin TabDlg.SSTab SSTab1
Height = 2895
Left = 0
TabIndex = 2
Top = 2520
Width = 7365
_ExtentX = 12991
_ExtentY = 5106
_Version = 393216
TabOrientation = 1
Style = 1
Tabs = 2
TabHeight = 520
TabCaption(0) = "消息"
TabPicture(0) = "frmDocument.frx":0000
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "Text1"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).ControlCount= 1
TabCaption(1) = "网格"
TabPicture(1) = "frmDocument.frx":001C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "Grid1(0)"
Tab(1).ControlCount= 1
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 1215
Left = 120
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 7
Top = 360
Width = 1935
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid1
Height = 1335
Index = 0
Left = -74760
TabIndex = 8
Top = 120
Width = 3015
_ExtentX = 5318
_ExtentY = 2355
_Version = 393216
AllowUserResizing= 3
_NumberOfBands = 1
_Band(0).Cols = 2
End
End
Begin MSWinsockLib.Winsock Winsock1
Left = 480
Top = 2880
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin RichTextLib.RichTextBox rtfText
Height = 1995
Left = 120
TabIndex = 0
Top = 120
Width = 3000
_ExtentX = 5292
_ExtentY = 3519
_Version = 393217
Enabled = -1 'True
ScrollBars = 3
DisableNoScroll = -1 'True
RightMargin = 1.00000e5
TextRTF = $"frmDocument.frx":0038
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 1
Top = 5730
Width = 7545
_ExtentX = 13309
_ExtentY = 450
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 4
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 2
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 2
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 3784
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 3784
EndProperty
EndProperty
End
Begin MSComDlg.CommonDialog dlgCommonDialog
Left = 3600
Top = 840
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DefaultExt = "txt"
Filter = "sql 脚本文件(*.sql)|*.sql|text 文件(*.txt)|*.txt|所有文件(*.*)|*.*"
InitDir = "c:/"
End
End
Attribute VB_Name = "frmDocument"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public com As ADODB.command
Private mintCurFrame As Integer ' Current Frame visible
Public gridn As Integer
Private Sub Form_Load()
Form_Resize
'建立数据库的语句句柄
Set com = New ADODB.command
com.CommandTimeout = 50
com.ActiveConnection = adoconn
'设置frmd状态栏
If computername = "" Then computername = Winsock1.LocalHostName
Me.Caption = computername + "\" + username + ":" + "query-non document " & lDocumentCount
'获得光标坐标
Dim LineNo As Long, ColNo As Long
Call GetCaretPos(rtfText.hwnd, LineNo, ColNo)
StatusBar1.Panels(1).Text = "line:" & LineNo '显示行
StatusBar1.Panels(2).Text = "col:" & ColNo '显示列
StatusBar1.Panels(3).Text = computername + "\" + username
StatusBar1.Panels(4).Text = "master"
mintCurFrame = 1
End Sub
Public Sub Form_Resize()
On Error Resume Next
rtfText.Move 100, 0, Me.ScaleWidth - 200, (Me.ScaleHeight - Me.StatusBar1.Height) * 60 / 100
SSTab1.Move 100, (Me.ScaleHeight - Me.StatusBar1.Height) * 60 / 100, Me.ScaleWidth - 200, (Me.ScaleHeight - Me.StatusBar1.Height) * 40 / 100
Me.Text1.Move 25, 25, Me.SSTab1.Width - 70, Me.SSTab1.Height - 380
Me.Text3.Top = Me.ScaleHeight - 300 - Me.StatusBar1.Height
Me.prev.Top = Me.ScaleHeight - 300 - Me.StatusBar1.Height
Me.next.Top = Me.ScaleHeight - 300 - Me.StatusBar1.Height
n = gridn
While n >= 0
Me.Grid1(n).Move 0, 0, Me.ScaleWidth - 210, Me.SSTab1.Height - 350
n = n - 1
Wend
err.Clear
End Sub
Private Sub Form_Unload(Cancel As Integer)
v = MsgBox("whether to save the file?", 1)
If v = 1 Then
Dim sfile As String
If Left$(Right$(Me.Caption, 20), 8) = "query-no" Then
With dlgCommonDialog
.DialogTitle = "保存"
.CancelError = False
'ToDo: 设置 common dialog 控件的标志和属性
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
End If
sfile = .FileName
End With
Me.Caption = sfile
Me.rtfText.SaveFile sfile, 1
Else
sfile = Me.Caption
Me.rtfText.SaveFile sfile, 1
End If
End If
Unload Me
End Sub
Private Sub next_Click()
Me.prev.Enabled = True
Dim num As Integer
num = Val(Text3.Text)
Grid1(num).Visible = False
Grid1(num + 1).Visible = True
Text3.Text = num + 1
If num + 1 = currgN Then Me.next.Enabled = False
End Sub
Private Sub prev_Click()
Me.next.Enabled = True
Dim num As Integer
num = Val(Text3.Text)
Grid1(num).Visible = False
Grid1(num - 1).Visible = True
Text3.Text = num - 1
If num - 1 <= 1 Then Me.prev.Enabled = False
End Sub
'用于光标定位
Private Sub rtfText_KeyUp(KeyCode As Integer, Shift As Integer)
Dim LineNo As Long, ColNo As Long
Call GetCaretPos(rtfText.hwnd, LineNo, ColNo)
StatusBar1.Panels(1).Text = "line:" & LineNo '显示行
StatusBar1.Panels(2).Text = "col:" & ColNo '显示列
End Sub
Private Sub rtfText_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim LineNo As Long, ColNo As Long
Call GetCaretPos(rtfText.hwnd, LineNo, ColNo)
StatusBar1.Panels(1).Text = "line:" & LineNo '显示行
StatusBar1.Panels(2).Text = "col:" & ColNo '显示列
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
If PreviousTab = 1 Then
Me.Text1.Visible = True
Else
Me.Text1.Visible = False
Call Form_Resize
End If
End Sub
Private Sub text1_DblClick()
Dim LineNo As Long, ColNo As Long
Dim errorline As Integer
Dim Line As Integer
Dim rowtext As String
Call GetCaretPos(Me.Text1.hwnd, LineNo, ColNo)
Call TB_GetLine(Text1.hwnd, LineNo - 1, rowtext)
If Mid$(rowtext, 48, 2) = "第 " Then '如果是英语版本msde则将条件语句换成“Mid$(Text1.text, 48, 5) = "Line " ”
errorline = Val(Mid$(rowtext, 50)) '如果是英语版本msde则将换成(Text1.text, 53)
Line = 0
Dim n As Integer
n = 0
While Line < errorline - 1
n = n + InStr(Mid(Me.rtfText.Text, n + 1, Len(Me.rtfText.Text) - n - 1), Chr(10))
Line = Line + 1
Wend
Me.rtfText.SetFocus
Me.rtfText.SelStart = n
If InStr(Mid(Me.rtfText.Text, n + 1, Len(Me.rtfText.Text) - n - 1), Chr(10)) = 0 Then
Me.rtfText.SelLength = Len(Me.rtfText.Text) - n
Else
Me.rtfText.SelLength = InStr(Mid(Me.rtfText.Text, n + 1, Len(Me.rtfText.Text) - n - 1), Chr(10)) - 2
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -