Modify form a parti User control properties of a VB.NET DLL

Asked

Viewed 362 times

0

I have a Library raised in Visual Basic . NET that accesses the properties of a Form, and so far so good! The problem is that when I try to access the component UserControl nothing on the form is amended.

Code:

        Dim PlayerHD As Frm_PlayerHDStudio
        Dim PlayerHD_X As Int32
        Dim PlayerHD_Y As Int32

        PlayerHD = New Frm_PlayerHDStudio()
        PlayerHD_X = PlayerHD.Size.Width
        PlayerHD_Y = PlayerHD.Size.Height
#Region "Primeiro Controle- ControlPlayerHD_InfoVideo"
        'Loc_ << Location do Controle
        'Sz_ << Tamando do Controle

        ''Declação de tamnho e largura do controle

        ''Loc
        Dim Loc_ControleInfoVideoX As Int32 = 0
        Dim Loc_ControleInfoVideoY As Int32 = 0

        ''Sz 
        Dim Sz_ControleInfoVideoX As Int32 = 1366
        Dim Sz_ControleInfoVideoY As Int32 = 10

        ''Localização do Controle InfoVideo
        PlayerHD.ControlPlayerHD_InfoVideo.Location = New Point(Loc_ControleInfoVideoX, Loc_ControleInfoVideoY)

        ''Tamanho do Controle
        PlayerHD.ControlPlayerHD_InfoVideo.Size = New Point(Sz_ControleInfoVideoX, Sz_ControleInfoVideoY)
#End Region

The application not of the error but the component which is in the Form remains in the same place it does not change its location.

1 answer

2


Add the following statements in his last line:

 MyClass.Controls.Add(PlayerHD)
 PlayerHD.Visible = True : PlayerHD.BringToFront()

If not resolved try this:

 PlayerHD.Location = New System.Drawing.PointF(Loc_ControleInfoVideoX, Loc_ControleInfoVideoY)
 PlayerHD.Update()

Or try to use the property Dock: (easier and practical)

 PlayerHD.Dock = Windows.Forms.DockStyle.Top 'Alinhamento em cima, você pode colocar qualquer lugar
 PlayerHD.Size = New Drawing.Size(PlayerHD.Width, Sz_ControleInfoVideoX)

try it, hugs ^-^

  • 1

    Vlw! the second caught perfectly.. the first when I ran the function the form closed :(..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.