IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Création d'une ligne et son déplacement


Sujet :

VB.NET

  1. #1
    Membre averti Avatar de megamario
    Homme Profil pro
    VB6/VB.net/C/C++/C#
    Inscrit en
    Septembre 2008
    Messages
    929
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : VB6/VB.net/C/C++/C#
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2008
    Messages : 929
    Points : 312
    Points
    312
    Par défaut Création d'une ligne et son déplacement
    Bonjour à tous,

    Je fait actuellement un petit logiciel me permettant d'exporter un synoptique en XML afin que mes autres logiciels créer ce synoptique de façons dynamique.

    J'ai donc fait un soft ou j'ai une base d'objet graphique (des picturebox, textbox, label...). Je clique sur l'un de ces objets et il se place dans un groupebox. Ce qui sera contenu dans le groupbox sera exporté (type d'objet, coordonnées, tailles et plein d'autre paramètres que je donnerais aussi lors de la création de l'objet) afin donc de créer dynamiquement la même chose dans les autre logiciel.

    La création dans les autres logiciels fonctionne deja, mais je me tape le XML à la main. C'est barbant surtout si l'on me change le synoptique ou j'ai toutes les coordonnées à modifier.

    Revenons à mon souci après cette petite présentation.

    Mes objets graphiques sont relier entre eux par des lignes, et c'est la mon souci. en VB6 il y a "line" ou l'on a juste à créer une ligne puis à en modifier les paramètres par x1,x2,y1,y2 si l'on souhaite la bouger.

    L'idéal:

    Que je puisse donc créer une ligne puis la déplacer soit par le centre (ou presque) pour déplacer la ligne intégralement. Soit déplacer uniquement les terminaisons. Et le top du top serait que ces lignes s'aligne avec le centre des picturebox suivant le coté du raccordement

    Pour déplacer les picturebox à l'aide de la souris j'ai utilisé cela:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
        Private Const WM_NCLBUTTONDOWN = &HA1
        Private Const HTCAPTION = 2
        Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
                     (ByVal hwnd As Integer, ByVal wMsg As Integer, _
                      ByVal wParam As Integer, ByVal lParam As String) As Integer
        Private Declare Sub ReleaseCapture Lib "user32" ()
     
        'Déplacement de la PictureBox
     
        Private Sub pictBox_MouseMove(ByVal sender As PictureBox, ByVal e As System.Windows.Forms.MouseEventArgs)
            Dim lHwnd As Integer
            lHwnd = sender.Handle
            If lHwnd = 0 Then Exit Sub
            ReleaseCapture()
            SendMessage(lHwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
     
        End Sub
    Lors de la création dynamique des picturebox j'associe Evènements.

    Pour la création de la ligne j'ai vu que l'on pouvait utiliser System.Drawing.Pen, mais je n'arrive pas pour le moment à l'utiliser, surtout pour le déplacement par la suite et récupérer ces 4 coordonnées que je stock dans une collection pour la création du XML.

    Le début de mon prog, il manque encore pleins d'objets
    Nom : 1.png
Affichages : 274
Taille : 67,2 Ko

    Une fois que je sélectionne l'un des objets, j'indique pas mal de chose, mais j'en ai encore à rentrer.
    Nom : 2.png
Affichages : 276
Taille : 18,8 Ko

    L'objet insert dans le groupbox
    Nom : 3.png
Affichages : 243
Taille : 33,4 Ko

    Je le deplace à l'aide de la souris
    Nom : 4.png
Affichages : 268
Taille : 31,4 Ko

    Voila après plusieurs insertions.
    Nom : 5.png
Affichages : 280
Taille : 69,7 Ko
    En bas on voie les coordonnées du dernier objet que j'ai déplacé (4 coordonnées pour les lignes bien sur), je peux aussi saisir les coordonnées afin de les aligner parfaitement.
    Il reste donc les lignes à ajouter.

    Merci de votre aide

  2. #2
    Membre averti Avatar de megamario
    Homme Profil pro
    VB6/VB.net/C/C++/C#
    Inscrit en
    Septembre 2008
    Messages
    929
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Activité : VB6/VB.net/C/C++/C#
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2008
    Messages : 929
    Points : 312
    Points
    312
    Par défaut
    A force de chercher et tester des trucs j'ai réussi.

    Voici mon code:

    Code Form1
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    Imports Microsoft.VisualBasic.PowerPacks
     
    Public Class Form1
        Private Const WM_NCLBUTTONDOWN = &HA1
        Private Const HTCAPTION = 2
        Private idxSelectBox As Integer
        Private idxSelectLine As Integer
        Private idxSelectType As MyTyp
        Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
                     (ByVal hwnd As Integer, ByVal wMsg As Integer, _
                      ByVal wParam As Integer, ByVal lParam As String) As Integer
        Private Declare Sub ReleaseCapture Lib "user32" ()
     
        'Déplacement de la ligne
        Private dragging As Boolean = False
        Private oldShapePosition1 As Point
        Private oldShapePosition2 As Point
        Private mouseDownX1 As Integer 'Mouse position based on ShapeContainer
        Private mouseDownY1 As Integer
        Private mouseDownX2 As Integer
        Private mouseDownY2 As Integer
        Private idxLineMove As Integer
        Private SelectBox As Boolean
        Private selectline As Boolean
     
     
     
     
     
        'Déplacement de la PictureBox
        Private Sub pictBox_MouseMove(ByVal sender As PictureBox, ByVal e As System.Windows.Forms.MouseEventArgs)
            Dim lHwnd As Integer
            lHwnd = sender.Handle
            If lHwnd = 0 Then Exit Sub
            ReleaseCapture()
            SendMessage(lHwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
            MouveBox(sender)
     
        End Sub
     
        Private Sub MouveBox(ByVal Pict As PictureBox)
            idxSelectBox = Pict.Tag
            SelectBox = True
            selectline = False
            idxSelectType = CollBox(Pict.Tag).Tp
            CollBox(Pict.Tag).X1 = Pict.Left
            CollBox(Pict.Tag).Y1 = Pict.Top
            txtX1.Text = CStr(Pict.Left)
            txtY1.Text = CStr(Pict.Top)
            txtX2.Text = ""
            txtY2.Text = ""
        End Sub
     
     
        Private Sub GroupBox2_Resize(sender As System.Object, e As System.EventArgs) Handles GroupBox2.Resize
     
        End Sub
     
        Private Sub PictureBox_Click(sender As System.Object, e As System.EventArgs) Handles pictBox1.Click, pictBox9.Click, pictBox8.Click, pictBox7.Click, pictBox6.Click, pictBox5.Click, pictBox4.Click, pictBox3.Click, pictBox2.Click, pictBox13.Click, pictBox12.Click, pictBox11.Click, pictBox10.Click
     
            Dim tpBox As Integer = Val(sender.tag)
     
            Dim param As New frmParam(tpBox)
            If param.ShowDialog() = Windows.Forms.DialogResult.OK Then
                If CollBox.Count > 0 Then
                    createBOX()
                End If
            End If
        End Sub
        Private Sub lblline_Click(sender As System.Object, e As System.EventArgs) Handles lblline.Click
            Dim tpBox As Integer = Val(sender.tag)
            Dim param As New frmLineAdd()
            If param.ShowDialog() = Windows.Forms.DialogResult.OK Then
                createLine()
            End If
        End Sub
     
     
        Private Sub createBOX()
            Dim idx As Integer = CollBox.Count - 1
            CollBox(idx).Box = New PictureBox
            CollBox(idx).Box.Image = ImageList1.Images(CollBox(idx).Tp)
            CollBox(idx).Box.Name = "Pict" & CStr(idx)
            CollBox(idx).Box.Size = New Size(40, 40)
            CollBox(idx).Box.Location = New Point(0, 0)
            CollBox(idx).Box.ContextMenuStrip = ContextMenuStrip1
            CollBox(idx).Box.Tag = idx
            Me.Panel1.Controls.Add(CollBox(idx).Box)
            AddHandler CollBox(idx).Box.MouseMove, AddressOf pictBox_MouseMove
        End Sub
     
        Private Sub SupprimerToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SupprimerToolStripMenuItem.Click
     
            Me.Panel1.Controls.Remove(CollBox(idxSelectBox).Box)
            CollBox.Remove(idxSelectBox)
        End Sub
     
        Private Sub cmdValidMove_Click(sender As System.Object, e As System.EventArgs) Handles cmdValidMove.Click
            Dim X1 As Integer = Val(txtX1.Text)
            Dim X2 As Integer = Val(txtX2.Text)
            Dim Y1 As Integer = Val(txtY1.Text)
            Dim Y2 As Integer = Val(txtY2.Text)
            Dim blackPen As New Pen(Color.Black, 3)
            If CollBox.Count > 0 Then
     
                If SelectBox And CollBox(idxSelectBox).Tp <> MyTyp.line Then
                    CollBox(idxSelectBox).Box.Top = Y1
                    CollBox(idxSelectBox).Box.Left = X1
                Else
                    If selectline Then
                        CollLine(idxSelectLine).line.StartPoint = New System.Drawing.Point(X1, Y1)
                        CollLine(idxSelectLine).line.EndPoint = New System.Drawing.Point(X2, Y2)
                    End If
                End If
            End If
     
        End Sub
     
     
    #Region "Line"
        Const HitTestDelta As Integer = 10
        ' The mouse position when mouse down 
        Dim oldMouseX As Integer
        Dim oldMouseY As Integer
     
        ' The line position when mouse down. 
        Dim oldStartPoint As Point
        Dim oldEndPoint As Point
     
        Dim dragStartPoint As Boolean = False
        Dim dragEndPoint As Boolean = False
     
        Private Sub createLine(Optional ByVal line As LineShape = Nothing)
            Dim valLine As Boolean = False
            If line IsNot Nothing Then
                valLine = True
            End If
            Dim idx As Integer = CollLine.Count - 1
            CollLine(idx).line = New LineShape
            CollLine(idx).LineCont = New ShapeContainer
            CollLine(idx).line.Name = "Line" & CStr(idx)
     
            CollLine(idx).line.BorderColor = Color.Black
            CollLine(idx).line.BorderWidth = CollLine(idx).Epaisseur
     
            CollLine(idx).line.Tag = idx
            CollLine(idx).LineCont.Parent = Me.Panel1
            CollLine(idx).line.Parent = CollLine(idx).LineCont
            If valLine Then
                CollLine(idx).line.StartPoint = New System.Drawing.Point(line.X1 + 10, line.Y1 + 10)
                CollLine(idx).line.EndPoint = New System.Drawing.Point(line.X2 + 10, line.Y2 + 10)
            Else
                CollLine(idx).line.StartPoint = New System.Drawing.Point(idx * 20, 60 + idx * 60)
                CollLine(idx).line.EndPoint = New System.Drawing.Point(100 + idx * 20, 110 + idx * 60)
            End If
            CollLine(idx).line.BringToFront()
            CollLine(idx).LineCont.BringToFront()
            Me.Panel1.Controls.Add(CollLine(idx).LineCont)
            CollLine(idx).line.ContextMenuStrip = ContextMenuStrip2
     
            ' add handlers
            AddHandler CollLine(idx).LineCont.MouseDown, AddressOf ShapeContainerMouseDownEventHandler
            AddHandler CollLine(idx).LineCont.MouseMove, AddressOf ShapeContainerMouseMoveEventHandler
            AddHandler CollLine(idx).LineCont.MouseUp, AddressOf ShapeContainerMouseUpEventHandler
     
        End Sub
     
        Private Sub ShapeContainerMouseDownEventHandler(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
     
            Dim siSCId As Integer
            Dim myShapeContainer As ShapeContainer
            myShapeContainer = CType(sender, ShapeContainer)
     
            Dim myLineShape As LineShape
            siSCId = sender.tag
            idxSelectLine = siSCId
            If siSCId > -1 Then
     
                myLineShape = CollLine(siSCId).line
     
                myShapeContainer.BringToFront()
     
                If (myLineShape.HitTest(MousePosition.X, MousePosition.Y)) Then
                    oldMouseX = e.X
                    oldMouseY = e.Y
     
                    oldStartPoint = myLineShape.StartPoint
                    oldEndPoint = myLineShape.EndPoint
     
                    dragStartPoint = MouseIsNearBy(oldStartPoint)
                    dragEndPoint = MouseIsNearBy(oldEndPoint)
                    If (Not dragStartPoint AndAlso Not dragEndPoint) Then
                        'If not drag either end, then drag both. 
                        dragStartPoint = True
                        dragEndPoint = True
                    End If
                    myLineShape.SelectionColor = Color.Transparent
                End If
            End If
     
     
        End Sub
        Private Sub ShapeContainerMouseMoveEventHandler(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
     
            Dim siSCId As Integer
            Dim myShapeContainer As ShapeContainer
            myShapeContainer = CType(sender, ShapeContainer)
     
            Dim myLineShape As LineShape
     
            siSCId = sender.tag()
            If siSCId > -1 Then
                SelectBox = False
                selectline = True
                myLineShape = CollLine(siSCId).line
     
                If (dragStartPoint) Then
                    txtX1.Text = CStr(oldStartPoint.X + e.X - oldMouseX)
                    txtY1.Text = CStr(oldStartPoint.Y + e.Y - oldMouseY)
                    myLineShape.StartPoint = New Point(oldStartPoint.X + e.X - oldMouseX, oldStartPoint.Y + e.Y - oldMouseY)
                End If
                If (dragEndPoint) Then
                    txtX2.Text = CStr(oldEndPoint.X + e.X - oldMouseX)
                    txtY2.Text = CStr(oldEndPoint.Y + e.Y - oldMouseY)
                    myLineShape.EndPoint = New Point(oldEndPoint.X + e.X - oldMouseX, oldEndPoint.Y + e.Y - oldMouseY)
                End If
     
            End If
     
        End Sub
        Private Sub ShapeContainerMouseUpEventHandler(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
     
            Dim siSCId As Integer
            Dim myShapeContainer As ShapeContainer
            myShapeContainer = CType(sender, ShapeContainer)
     
            Dim myLineShape As LineShape
     
            siSCId = sender.tag
            If siSCId > -1 Then
                myLineShape = CollLine(siSCId).line
     
                dragStartPoint = False
                dragEndPoint = False
                myLineShape.SelectionColor = Color.Transparent
            End If
     
            myShapeContainer.Parent.Refresh()
     
        End Sub
        Private Function MouseIsNearBy(ByVal testPoint As Point) As Boolean
            Dim X = MousePosition.X ' - 5
            Dim Y = MousePosition.Y '- 10
            testPoint = Panel1.PointToScreen(testPoint)
            Return Math.Abs(testPoint.X - X) <= HitTestDelta _
            AndAlso Math.Abs(testPoint.Y - Y) <= HitTestDelta
        End Function
     
        Private Sub CouleurToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CouleurToolStripMenuItem.Click
            Dim colorPicker As New ColorDialog()
     
            Try
                colorPicker.ShowHelp = True
     
                Dim siClickedShapeContainerId As Integer = -1
                siClickedShapeContainerId = sender.tag
                colorPicker.Color = CollLine(siClickedShapeContainerId).line.BorderColor
     
                If (colorPicker.ShowDialog() = Windows.Forms.DialogResult.OK) Then
                    CollLine(siClickedShapeContainerId).line.BorderColor = colorPicker.Color
                End If
     
            Catch ex As Exception
                MessageBox.Show("Sub ITM1_Click: " & ex.Message, Me.Text)
            End Try
     
            colorPicker.Dispose()
        End Sub
     
        Private Sub EpaisseurToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles EpaisseurToolStripMenuItem.Click
            Dim myDlgLineWidth As New DlgLineWidth
     
            Try
                Dim siClickedShapeContainerId As Integer = -1
                siClickedShapeContainerId = sender.tag
                myDlgLineWidth.LineWidth = CollLine(siClickedShapeContainerId).line.BorderWidth
     
                If myDlgLineWidth.ShowDialog = Windows.Forms.DialogResult.OK Then
                    CollLine(siClickedShapeContainerId).line.BorderWidth = myDlgLineWidth.LineWidth
                End If
     
            Catch ex As Exception
                MessageBox.Show("Sub ITM2_Click: " & ex.Message, Me.Text)
            End Try
     
            myDlgLineWidth.Dispose()
        End Sub
     
        Private Sub SuppressionToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SuppressionToolStripMenuItem.Click
            Try
                Dim siClickedShapeContainerId As Integer = -1
     
                siClickedShapeContainerId = sender.tag
     
                Me.Panel1.Controls.Remove(CollLine(siClickedShapeContainerId).LineCont)
                CollLine.Remove(siClickedShapeContainerId)
     
     
            Catch ex As Exception
                MessageBox.Show("Sub ITM2_Click: " & ex.Message, Me.Text)
            End Try
     
        End Sub
        Private Sub CopierToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CopierToolStripMenuItem.Click
            createLine(CollLine(idxSelectLine).line)
        End Sub
    #End Region
     
     
    End Class
    Module
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    Module Modvar
     
        Public Enum MyTyp
            GE = 0
            Contacteur = 1
            Fusible = 2
            Interupteur = 3
            Onduleur = 4
            Redresseur = 5
            SBS = 6
            Sectionneur = 7
            SectionneurH = 8
            Selecteur = 9
            InterupteurBas = 10
            InterupteurMillieux = 11
            InterupteurHaut = 12
            line = 100
        End Enum
        Public Enum MyLogic
            Positive = 0
            negative = 1
        End Enum
        Public Enum MyGroup
            Seul = 0
            Groupe = 1
            iniore = 2
        End Enum
     
     
        Public CollBox As Dictionary(Of Integer, clsParam)
        Public CollLine As Dictionary(Of Integer, clsParam)
     
     
    End Module
    frmparam
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    Public Class frmParam
        Private newNum As Integer
        Private _Tp As Integer
     
        Public Sub New(ByVal Tp As Integer)
     
            ' Cet appel est requis par le concepteur.
            InitializeComponent()
     
            ' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
            If CollBox Is Nothing Then
                CollBox = New Dictionary(Of Integer, clsParam)
            End If
            If CollBox.Count > 0 Then
                newNum = CollBox(CollBox.Count - 1).Num + 1
            Else
                newNum = 0
            End If
            txtNewNum.Text = CStr(newNum)
            txtTypebox.Text = CStr(Tp)
            _Tp = Tp
            pict1.Image = Form1.ImageList1.Images(Tp)
        End Sub
     
        Private Sub cmdOK_Click(sender As System.Object, e As System.EventArgs) Handles cmdOK.Click
            Dim cls As New clsParam
            cls.Num = newNum
     
            cls.Name = txtNom.Text
            cls.Attribut = txtAttribut.Text
            cls.Myobject = txtObj.Text
            cls.indName = CkIndNom.Checked
            If rbGroupe.Checked Then
                cls.Groupe = MyGroup.Groupe
            ElseIf rbSeul.Checked Then
                cls.Groupe = MyGroup.Seul
            Else
                cls.Groupe = MyGroup.iniore
            End If
            If rbPositive.Checked Then
                cls.logic = MyLogic.Positive
            ElseIf rbNegative.Checked Then
                cls.logic = MyLogic.negative
            End If
            cls.Tp = _Tp
            CollBox.Add(newNum, cls)
            Me.Hide()
     
        End Sub
        Public Function getNum() As Integer
            getNum = newNum
        End Function
     
        Private Sub cmdCancel_Click(sender As System.Object, e As System.EventArgs) Handles cmdCancel.Click
            Me.Hide()
        End Sub
    End Class
    clsParam
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    Imports Microsoft.VisualBasic.PowerPacks
     
    Public Class clsParam
        Private _Box As PictureBox
        Private _Line As LineShape
        Private _LineCont As ShapeContainer
        Private _Epaisseur As Integer
        Private _NumBox As Integer
        Private _tp As MyTyp
        Private _Name As String
        Private _indName As Boolean
        Private _object As String
        Private _Attribut As String
        Private _logic As MyLogic
        Private _Groupe As MyGroup
        Private _Y1 As Integer
        Private _Y2 As Integer
        Private _X1 As Integer
        Private _X2 As Integer
        Private _Height As Integer
        Private _Length As Integer
        Private _fluxBox As String
        Private _fluxWire As String
     
        Public Sub New()
            _Box = Nothing
            _Line = Nothing
            _LineCont = Nothing
            _Epaisseur = 4
            _NumBox = 0
            _tp = MyTyp.Contacteur
            _Name = ""
            _indName = False
            _object = ""
            _Attribut = ""
            _Groupe = MyGroup.Seul
            _Y1 = 0
            _Y2 = 0
            _X1 = 0
            _X2 = 0
            _Height = 0
            _Length = 0
            _fluxBox = ""
            _fluxWire = ""
        End Sub
        Public Property line() As LineShape
            Get
                line = _Line
            End Get
            Set(value As LineShape)
                _Line = value
            End Set
        End Property
        Public Property LineCont() As ShapeContainer
            Get
                LineCont = _LineCont
            End Get
            Set(value As ShapeContainer)
                _LineCont = value
            End Set
        End Property
        Public Property Box() As PictureBox
            Get
                Box = _Box
            End Get
            Set(value As PictureBox)
                _Box = value
            End Set
        End Property
     
        Public Property Num() As Integer
            Get
                Num = _NumBox
            End Get
            Set(value As Integer)
                _NumBox = value
            End Set
        End Property
        Friend Property Tp() As MyTyp
            Get
                Tp = _tp
            End Get
            Set(value As MyTyp)
                _tp = value
            End Set
        End Property
        Public Property Name() As String
            Get
                Name = _Name
            End Get
            Set(value As String)
                _Name = value
            End Set
        End Property
        Public Property indName() As Boolean
            Get
                indName = _indName
            End Get
            Set(value As Boolean)
                _tp = value
            End Set
        End Property
        Public Property Myobject() As String
            Get
                Myobject = _object
            End Get
            Set(value As String)
                _object = value
            End Set
        End Property
     
        Public Property Attribut() As String
            Get
                Attribut = _Attribut
            End Get
            Set(value As String)
                _Attribut = value
            End Set
        End Property
     
        Friend Property logic() As MyLogic
            Get
                logic = _logic
            End Get
            Set(value As MyLogic)
                _logic = value
            End Set
        End Property
        Friend Property Groupe() As MyGroup
            Get
                Groupe = _Groupe
            End Get
            Set(value As MyGroup)
                _Groupe = value
            End Set
        End Property
        Public Property Y1() As Integer
            Get
                Y1 = _Y1
            End Get
            Set(value As Integer)
                _Y1 = value
            End Set
        End Property
        Public Property Y2() As Integer
            Get
                Y2 = _Y2
            End Get
            Set(value As Integer)
                _Y2 = value
            End Set
        End Property
        Public Property X1() As Integer
            Get
                X1 = _X1
            End Get
            Set(value As Integer)
                _X1 = value
            End Set
        End Property
        Public Property X2() As Integer
            Get
                X2 = _X2
            End Get
            Set(value As Integer)
                _X2 = value
            End Set
        End Property
        Public Property Height() As Integer
            Get
                Height = _Height
            End Get
            Set(value As Integer)
                _Height = value
            End Set
        End Property
        Public Property Length() As Integer
            Get
                Length = _Length
            End Get
            Set(value As Integer)
                _Length = value
            End Set
        End Property
     
        Public Property fluxBox() As String
            Get
                fluxBox = _fluxBox
            End Get
            Set(value As String)
                _fluxBox = value
            End Set
        End Property
     
        Public Property fluxWire() As String
            Get
                fluxWire = _fluxWire
            End Get
            Set(value As String)
                _fluxWire = value
            End Set
        End Property
     
     
     
        Public Property Epaisseur() As Integer
            Get
                Epaisseur = _Epaisseur
            End Get
            Set(value As Integer)
                _Epaisseur = _Epaisseur
            End Set
        End Property
     
    End Class
    J'ajoute les objets dans un Panel car j'avais une différence de Location avec le groupbox directement entre les lignes et picture, du coup si je voulait ajuster manuellement les ligne au picture j'avais un écart de 16 pixel.

    Ce code est loin d’être fini

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [1.x] Ajout automatique lors de la création d'une ligne
    Par Dash777 dans le forum Symfony
    Réponses: 3
    Dernier message: 07/05/2010, 17h10
  2. Création d'une ligne moyenne Normalisée
    Par youcef60 dans le forum Mathématiques
    Réponses: 13
    Dernier message: 02/03/2010, 15h54
  3. [Débutant] Création d'une ligne
    Par Schniko dans le forum IHM
    Réponses: 3
    Dernier message: 06/05/2008, 09h52
  4. création d'une imprimante par son adresse mac
    Par cedric49fr2000 dans le forum Windows Serveur
    Réponses: 1
    Dernier message: 03/04/2008, 11h33
  5. afficher une ligne(par son numero) d'une JTable
    Par linouline dans le forum Composants
    Réponses: 7
    Dernier message: 27/05/2006, 14h11

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo