关于Vb6 的编程问题
Private Sub Form_Load()
Dim P As Integer, F As Integer, S As Integer, T1 As String, T2 As String
Command2.Enabled = False
End Sub
Private Sub Command1_Click()
P = Val(InputBox("请输入总页数(4的倍数)"))
If CInt(P / 4) <> Fix(P / 4) Or P = 0 Then
MsgBox "请输入4的倍数"
End If
If P <> 0 Then Command2.Enabled = True
End Sub
Private Sub Command3_Click()
Text1.Text = Str(P) & "," & "1"
Text1.Text = Trim(Text1.Text)
Text1.Text = Replace(Text1.Text, " ", "")
If P > 4 Then
For F = P - 2 To P / 2 + 2 Step -2
Text1.Text = Trim(Text1.Text)
Text1.Text = Replace(Text1.Text, " ", "")
Text1.Text = T1
Text1.Text = T1 & "," & Str(P + 1 - F)
Next F
End If
End Sub
Private Sub Command4_Click()
Clipboard.SetText = Text1.Text
End Sub
Private Sub Command5_Click()
Text2.Text = "2" & "," & Str(P)
Text2.Text = Trim(Text2.Text)
Text2.Text = Replace(Text2.Text, " ", "")
If P > 4 Then
For S = 4 To P / 2 Step 2
Text2.Text = Trim(Text2.Text)
Text2.Text = Replace(Text2.Text, " ", "")
T2 = Text2.Text
Text2.Text = T2 & "," & Str(P + 1 - S)
Next S
End If
End Sub
Private Sub Command6_Click()
Clipboard.SetText = Text2.Text
End Sub
Private Sub Command2_Click()
P = 0
F = 0
S = 0
Text1.Text = ""
Text2.Text = ""
Command2.Enabled = False
End Sub 展开
唉,你也不说都用些啥控件,也不说个控件的标题属性,更不说这个程序是要做啥的,还不说问题出在哪里,出了什么问题。
真让人头疼!!!!!!
好在我有耐心…………
我给你改了代码,设计了界面,并且是运行了。
如下:
'在设计时,应在属性窗口将两个文本框的“MultiLine”(多行性)设置为“Ture”(真)
'在设计时,应在属性窗口将两个文本框的“Scrollbars”(滚动条)设置为“2”(竖向)
Dim 总页码 As Integer
Private Sub Form_Load()
Command1.Caption = "输入页数"
Command2.Caption = "重来"
Command3.Caption = "复制外页"
Command4.Caption = "复制内页"
Label1 = "外页面"
Label2 = "内页面"
初始化
End Sub
Private Sub Command1_Click()
Dim F As Integer
总页码 = Val(InputBox("请输入总页数(4的倍数)"))
If 总页码 <= 0 Then
MsgBox "页码不能是负数!", vbExclamation + vbOKOnly
Else
Label3 = "有文字的页面数:" & 总页码
If Int(总页码 / 4) * 4 <> 总页码 Then
总页码 = Int(总页码 / 4 + 1) * 4
MsgBox "排版需要将总页码增加到" & 总页码, vbInformation + vbOKOnly
End If
Label3 = Label3 & vbCrLf & "排版页面共计:" & 总页码 & vbCrLf & "纸张:" & 总页码 / 4
Text1 = 总页码 & "," & "1"
Text2 = "2" & "," & 总页码 - 1
If 总页码 > 4 Then
For F = 3 To 总页码 / 2 - 1 Step 2
Text1 = Text1 & vbCrLf & 总页码 + 1 - F & "," & F
Text2 = Text2 & vbCrLf & F + 1 & "," & 总页码 - F
Next F
End If
Text1 = Replace(Text1, " ", "")
Text2 = Replace(Text2, " ", "")
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End If
End Sub
Private Sub Command2_Click()
初始化
End Sub
Private Sub Command3_Click()
Clipboard.SetText Text1.Text
End Sub
Private Sub Command4_Click()
Clipboard.SetText Text2.Text
End Sub
Private Sub 初始化()
总页码 = 0
F = 0
S = 0
Text1.Text = ""
Text2.Text = ""
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Label3 = ""
End Sub