none
Test sur le type ContainerControl RRS feed

  • Question

  • Bonjour,

    Je rencontre un problème pour tester le type ContainerControl

    If TypeOf (ElemControl) Is ContainerControl Then
         For Each ElemControlIN As Control In ElemControl.Controls
            ElemControlIN.Size = New Size(CInt(ElemControlIN.Width * CoefX), CInt(ElemControlIN.Height * CoefY))
            ElemControlIN.Location = New Point(CInt(ElemControlIN.Location.X * CoefX), CInt(ElemControlIN.Location.Y * CoefY))
         Next
    End If

    Le pb c'est que pour une GroupBox considérée comme un conteneur le test est False.

    Où est l'astuce ?

    Cordialement,

    vendredi 6 mai 2011 11:04

Réponses

  • Bonjour,

    Moi je fais comme ceci

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each MyControl As Control In Me.Controls
          If MyControl.Controls.Count > 0 Then
            For Each ElemControlIN As Control In MyControl.Controls
              ElemControlIN.Size = New Size(ElemControlIN.Width * 2, ElemControlIN.Height * 2)
              ElemControlIN.Location = New Point(ElemControlIN.Location.X * 2, ElemControlIN.Location.Y * 2)
            Next
          End If
        Next
      End Sub
    

    Cordialement,

     

     

     


    Cordialement,
    Xavier
    Alias Troxsa My M@iL
    vendredi 6 mai 2011 12:16
    Auteur de réponse

Toutes les réponses

  • Bonjour,

    Moi je fais comme ceci

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each MyControl As Control In Me.Controls
          If MyControl.Controls.Count > 0 Then
            For Each ElemControlIN As Control In MyControl.Controls
              ElemControlIN.Size = New Size(ElemControlIN.Width * 2, ElemControlIN.Height * 2)
              ElemControlIN.Location = New Point(ElemControlIN.Location.X * 2, ElemControlIN.Location.Y * 2)
            Next
          End If
        Next
      End Sub
    

    Cordialement,

     

     

     


    Cordialement,
    Xavier
    Alias Troxsa My M@iL
    vendredi 6 mai 2011 12:16
    Auteur de réponse
  • Merci, c'est Ok.

    vendredi 6 mai 2011 13:38