[VB.NET] besoin d'aide pour déchiffrer un code
Bonjour, je suis depuis quelque temps déjà à la recherche d'aide sur l'import de fichier dxf dans un programme vb.net.
j'ai trouvé sur le web un exemple de code source mais j'avoue ne pas bien le comprendre. Quelqu'un pourrait il y apporter des précisions en ajoutant des commentaires.
D'avance merci..
ps : le code complet étant assez long voici juste une petite partie qui, je pense, est suffisante
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| Imports CADImport
Imports System.IO
Imports System.Drawing.Imaging
Public Class CADImportDemoVb
Inherits System.Windows.Forms.Form
Private Const OnMouseScroll As Integer = 522
Private lForm As Form2 = New Form2
Private pos As Point = New Point
Private curClRect As Rectangle
Private wh As Single
Private CADParams As CADIterate
Private TextFile As ArrayList = New ArrayList
Private cX, cY As Integer
Private det1 As Boolean
Private Orb3D As Orbit3D = New Orbit3D
Public Shared FCADImage As CADImage
Private scale As Single = 1
Private ScaleRect As SFPoint
Private layouts As ArrayList = New ArrayList
Private aboutFrm As AboutForm = New AboutForm
Private vPt As SFPoint
Private old_x, old_y As Integer
Private Sub Open_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mOpenFile.Click
Dim i As Integer
pictureBox1.Visible = False
pos = New Point
If openFileDialog1.ShowDialog() <> DialogResult.OK Then
pictureBox1.Visible = True
Return
End If
If (openFileDialog1.FileName <> Nothing) Then
stBar.Panels(0).Text = "Load file..."
pnlLayouts.Visible = False
scale = 1
FCADImage = Nothing
FCADImage = New CADImage
FCADImage.Load(openFileDialog1.FileName)
End If
stBar.Panels(1).Text = "" + CType(scale, String)
stBar.Panels(0).Text = Path.GetFileName(openFileDialog1.FileName)
For i = 1 To 17
tlbTool.Buttons(i).Enabled = True
Next i
tlbTool.Buttons(8).Pushed = FCADImage.isDraw3DAxes
tlbTool.Buttons(10).Pushed = True
tlbTool.Buttons(11).Pushed = False
tlbTool.Buttons(12).Pushed = False
tlbTool.Buttons(7).Pushed = False
tlbTool.Buttons(13).Pushed = True
FCADImage.useWinEllipse = False
mScale.Enabled = True
mSaveFile.Enabled = True
Orb3D.cADImage = FCADImage
Orb3D.visible = False
Orb3D.Disable3dOrbit()
pictureBox1.Visible = True
'If pictureBox1.BackColor.Equals(Color.White) Then
' White_Click()
' Else : Black_Click()
'End If
ViewLayouts()
Form1_Resize(sender, e)
pos.X = (Me.ActiveForm.ClientRectangle.Width - curClRect.Width) / 2
pos.Y = (Me.ActiveForm.ClientRectangle.Height - curClRect.Height) / 2
pictureBox1.Invalidate()
End Sub
Private Sub ViewLayouts()
Dim I As Integer
If (FCADImage Is Nothing) Then Return
cbLayouts.Items.Clear()
layouts.Clear()
For I = 0 To FCADImage.Layouts.Count - 1
cbLayouts.Items.Add(CType(FCADImage.Layouts(I), CADLayout).name)
layouts.Add(FCADImage.Layouts(I))
Next (I)
cbLayouts.SelectedIndex = FCADImage.converter.DefaultLayoutIndex
FCADImage.CurrentLayout = CType(FCADImage.Layouts(cbLayouts.SelectedIndex), CADLayout)
pnlLayouts.Visible = True
End Sub |