Imports Autodesk.AutoCAD.DatabaseServices
Imports System.Collections
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'所有打印机名称
Dim N As Int16
N = Autodesk.AutoCAD.PlottingServices.PlotConfigManager.Devices.Count
Dim I As Int16
For I = 0 To N - 1
Me.ComboBox1.Items.Add(Autodesk.AutoCAD.PlottingServices.PlotConfigManager.Devices(I).DeviceName)
Next
Me.ComboBox1.Text = Me.ComboBox1.Items(0)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
'打印机对应的打印纸名称
Me.ComboBox2.Items.Clear()
Dim DeviceName As String = Me.ComboBox1.Text
If DeviceName <> "无" Then
Dim PSV As PlotSettingsValidator = PlotSettingsValidator.Current
Dim PS As PlotSettings = New PlotSettings(True)
PSV.SetPlotConfigurationName(PS, DeviceName, Nothing)
PSV.RefreshLists(PS)
Dim SC As System.Collections.Specialized.StringCollection = PSV.GetCanonicalMediaNameList(PS)
Dim i As Int16
Dim N As Int16
N = SC.Count - 1
For i = 0 To N
Me.ComboBox2.Items.Add(SC.Item(i))
Next
Me.ComboBox2.Text = SC.Item(0)
End If
End Sub
End Class
Imports System.Collections
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'所有打印机名称
Dim N As Int16
N = Autodesk.AutoCAD.PlottingServices.PlotConfigManager.Devices.Count
Dim I As Int16
For I = 0 To N - 1
Me.ComboBox1.Items.Add(Autodesk.AutoCAD.PlottingServices.PlotConfigManager.Devices(I).DeviceName)
Next
Me.ComboBox1.Text = Me.ComboBox1.Items(0)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
'打印机对应的打印纸名称
Me.ComboBox2.Items.Clear()
Dim DeviceName As String = Me.ComboBox1.Text
If DeviceName <> "无" Then
Dim PSV As PlotSettingsValidator = PlotSettingsValidator.Current
Dim PS As PlotSettings = New PlotSettings(True)
PSV.SetPlotConfigurationName(PS, DeviceName, Nothing)
PSV.RefreshLists(PS)
Dim SC As System.Collections.Specialized.StringCollection = PSV.GetCanonicalMediaNameList(PS)
Dim i As Int16
Dim N As Int16
N = SC.Count - 1
For i = 0 To N
Me.ComboBox2.Items.Add(SC.Item(i))
Next
Me.ComboBox2.Text = SC.Item(0)
End If
End Sub
End Class
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |