📄 frmdraw.frm
字号:
VERSION 5.00
Begin VB.Form frmDraw
Caption = "在VB图片框中显示MATLAB图形"
ClientHeight = 5295
ClientLeft = 60
ClientTop = 345
ClientWidth = 6675
LinkTopic = "Form1"
ScaleHeight = 5295
ScaleWidth = 6675
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdDraw
Caption = "将MATLAB图形显示到VB界面上"
Height = 375
Left = 1680
TabIndex = 0
Top = 4680
Width = 3255
End
Begin VB.Image imgDraw
BorderStyle = 1 'Fixed Single
Height = 4335
Left = 0
Stretch = -1 'True
Top = 120
Width = 6615
End
End
Attribute VB_Name = "frmDraw"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdDraw_Click()
Dim objMATLAB As Object
Set objMATLAB = CreateObject("matlab.application")
Dim strEnter As String
Dim strCommand As String
strEnter = Chr(13) & Chr(10)
strCommand = "[x,y,z]=peaks(30);"
strCommand = strCommand & strEnter
strCommand = strCommand & "surfc(x,y,z)"
strCommand = strCommand & strEnter
strCommand = strCommand & "shading interp"
strCommand = strCommand & strEnter
strCommand = strCommand & "saveas(gcf,'C:\temp.bmp')"
objMATLAB.execute (strCommand)
imgDraw.Picture = LoadPicture("C:\temp.bmp")
imgDraw.Refresh
Set objMATLAB = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -