?? frmmain.frm
字號:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Begin VB.Form FrmMain
Caption = "單純形法"
ClientHeight = 7095
ClientLeft = 60
ClientTop = 345
ClientWidth = 6540
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 7095
ScaleWidth = 6540
StartUpPosition = 2 'CenterScreen
WhatsThisButton = -1 'True
WhatsThisHelp = -1 'True
Begin VB.CommandButton Cmd_Branch
Caption = "分枝界定"
Enabled = 0 'False
Height = 495
Left = 2280
TabIndex = 6
Top = 6240
Width = 1475
End
Begin MSFlexGridLib.MSFlexGrid MSGrid
Height = 2775
Left = 600
TabIndex = 5
Top = 3000
Width = 5055
_ExtentX = 8916
_ExtentY = 4895
_Version = 393216
Rows = 11
Cols = 5
End
Begin VB.CommandButton Cmd_Exit
Caption = "退出"
Height = 495
Left = 3960
TabIndex = 4
Top = 6240
Width = 1575
End
Begin VB.Frame Frame2
Caption = "輸入陣列"
Height = 2535
Left = 360
TabIndex = 1
Top = 240
Width = 5295
Begin VB.TextBox TxtSubject
Height = 1695
Left = 360
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Top = 600
Width = 4455
End
Begin VB.Label Label3
Caption = "陣列數據"
ForeColor = &H000000FF&
Height = 255
Left = 2160
TabIndex = 2
Top = 240
Width = 855
End
End
Begin VB.CommandButton Cmd_Calcuate
Caption = "計算"
Height = 495
Left = 480
TabIndex = 0
Top = 6240
Width = 1575
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cmd_Branch_Click()
FrmBranch.Show 1
End Sub
Private Sub Cmd_Calcuate_Click()
Dim i%, j%
On Error GoTo myError
FrmMain.Cls
cs = ""
Dim Filenumber As Integer
Dim tt As Integer '判斷非基變量用
Dim strPrint As String, strPrintResult As String
Filenumber = FreeFile
Open strFile For Input As #Filenumber
Input #Filenumber, m, n ' m為約束變量,n為約束條件數
ReDim C(m) '價值系數
ReDim ibs(n) '基變量序列號
ReDim A(n, m) '約束矩陣
ReDim Cb(n) '基變量的價值系數
ReDim b(n) '右端項值
ReDim CA(m) '價值系數
ReDim ibsA(n) '基變量序列號
ReDim AA(n, m) '約束矩陣
ReDim CbA(n) '基變量的價值系數
ReDim bA(n) '右端項值
For i = 1 To m 'i代表橫向,j代表縱向
Input #Filenumber, C(i) '價值系數
CA(i) = C(i)
Next i
For j = 1 To n
Input #Filenumber, ibs(j) '基變量序列號
ibsA(j) = ibs(j)
Next j
For j = 1 To n
For i = 1 To m
Input #Filenumber, A(j, i) '矩陣
AA(j, i) = A(j, i)
Next i
Input #Filenumber, b(j)
bA(j) = b(j)
Next j
Close #Filenumber
lineprog A, b, C, ibs, m, n
MSGrid.TextMatrix(1, 1) = XX(1)
MSGrid.TextMatrix(2, 1) = XX(2)
MSGrid.TextMatrix(6, 1) = XX(3)
Cmd_Branch.Enabled = True
Exit Sub
myError:
MsgBox "輸入的文件結構可能不符合要求,請檢查后重試!", 0 + 16 + 0, "程序運行有故障"
End Sub
Private Sub Cmd_exit_Click()
End
End Sub
Private Sub Form_Load()
strFile = App.Path + "\inifile\matrix.txt"
Open App.Path + "\inifile\matrix.txt" For Input As 1
Dim nextline As String
strTxt = ""
Do Until EOF(1)
Line Input #1, nextline
strTxt = strTxt & nextline & Chr(13) & Chr(10)
Loop
Close #1
TxtSubject.Text = strTxt
MSGrid.TextMatrix(0, 0) = "約束變量值"
MSGrid.TextMatrix(1, 0) = " x1 "
MSGrid.TextMatrix(2, 0) = " x2 "
MSGrid.TextMatrix(6, 0) = " 目標值 "
MSGrid.TextMatrix(0, 1) = " 結果 "
End Sub
Private Sub TxtSubject_KeyUp(KeyCode As Integer, Shift As Integer)
Dim Filenumber As Integer
Filenumber = FreeFile
Open strFile For Output As #Filenumber
Print #1, TxtSubject.Text
Close #Filenumber
End Sub
Private Sub TxtSubject_LostFocus()
Open App.Path + "\inifile\matrix.txt" For Input As 1
Dim nextline As String
strTxt = ""
Do Until EOF(1)
Line Input #1, nextline
strTxt = strTxt & nextline & Chr(13) & Chr(10)
Loop
Close #1
TxtSubject.Text = strTxt
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -