USERCONTROLS & TOPS & BORDER

  • 13 years ago

    (ENGLISH) HELLO
    I WROTE A USERCONTROL THAT MIX COMBOBOX & CHECKLIST, FOR DO THAT I PUT A TEXTBOX , A COMMANDBUTTON, AND A LISTBOX WITH CHECK STYLE
     I PUT THEESE USER CONTROL NEAR TO BOTTOM FORM BORDER , WHEN I CLICK IN DROPDOWN BUTTON (THE COMMAND BUTTON) SHOW THE LIST WITH THE OPTIONS
     I NEED HELP TO SOLVE THESE PROBLEM, WHEN THE USER CONTROL IS NEAR TO THE FORM CONTAINER THE LIST SHOWS BEHIND THE BORDER OF FORM, BUT I NEED TO SHOW OVER THE FORM.
     I TAKE SOME TEST WITH USERCONTROL THAT USE A FORM AND CHANGE DE HWND TO USER CONTROL TO BRINF THE CONTROL TOPMOST, BUT WITHOUT SOLVE IT

     ANY KNOWS OR CAN HELP ME ????   VERY TRULY, THNX

     ALEJANDRO

     

    (SPANISH)HOLA

    ESCRIBI UN CONTROL DE USUARIO QE MEZCLA UN TEXTBOX , UN COMMAND BUTTON Y UN LISTBOX CON ESTILO CHECK, YO PONGO EL USERCONTROL CERCA DEL BORDER INFERIOR DEL FORM, CUANDO HAGO CLICK EN EL COMMANDBUTTON, MUESTRO EL LISTBOX CON LAS OPCIONES QUE DISPONGA

    NECESITO AYUDA PARA RESOLVE EL PROBLEMA, QUE CUANDO EL USUARIO HACE CLICK EN EL BUTTON, Y ME MUESTRA EL LISTBOX, ME APARECE ESCONDIDO DETRAS DEL BORDE DEL FORMULARIO Y YO NECESITO QUE APAREZCA POR SOBRE EL FORMULARIO

    HICE ALGUNAS PRUEBAS, CAMBIANDO EL HWND DEL USERCONTROL Y UTILIZANDO UN FORM VINCULADO Y QUE ME MUESTRE EL FORM COMO UN FORMULARIO TOP PERO NO LO PUDE RESOLVER

    ALGUIEN TIENE ALGUNA SOLUCION O AYUDA ? MUY CORDIALMENTE AGRADECIDO

    ALEJANDRO 

  • 13 years ago

    Suggestion:

    Make the background of your control = transparent.

    When the button is pressed, make the listbox visible.

    Change the height of your control to make it large enough to show the listbox.

    When a selection has been made, hide the listbox again, and reduce the height of the control.

    There may be a better way, but this works for me.

  • 13 years ago

    Crying

    dont work

    maybe i wrote something bad....

    cand you post the code ?

    thnx 

     

  • 13 years ago

    HERE THE CODE OF FORM

    Form2
       Caption         =   "Form1"
       ClientHeight    =   3195
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   4680
       ScaleHeight     =   3195
       ScaleWidth      =   4680
       StartUpPosition =   3  'Windows Default
     

    UserControl1 UserControl1
          Height          =   285
          Left            =   1800
          Top             =   2175
          Width           =   2550
    End

     

    HERE ME CODE  of USERCONTROL


    Private Sub dROP_Click()
        List.Visible = Not List.Visible
        If List.Visible Then
           UserControl.Height = UserControl.Height + 2385
        Else
           UserControl.Height = UserControl.Height - 2385
        End If
    End Sub

    Function Add(ByVal relativo As String, ByVal dato As String, estado As Boolean, key As String)
        List.AddItem (dato)
        List.Selected(List.NewIndex) = estado
    End Function

    Sub Clear()
        List.Clear
    End Sub

    Function Remove(ByVal key As String) As Boolean
               List.RemoveItem key
    End Function

    Private Sub UserControl_Resize()
    Dim nNewWidth  As Long
    If Not List.Visible Then
        Text.Move 0, 0, UserControl.ScaleWidth - dROP.Width, UserControl.ScaleHeight
        nNewWidth = UserControl.ScaleWidth - dROP.Width + 1
        dROP.Move nNewWidth, 0, dROP.Width, UserControl.ScaleHeight
        List.Move 0, UserControl.ScaleHeight, UserControl.ScaleWidth, UserControl.ScaleHeight + List.Height
    End If
    End Sub
     

     

    MAY HELP  

  • 13 years ago

    Not sure what you are seeing  when ;it does not work'

    I just put together an OCX that does this.

    The usercontrol has background set to transparent.

    To keep thing simple, I dont have much in the resize, but you need to have the control large enough to display the expanded listbox, no matter what the user thinks the size should be.

    So I dont think it makes sense to size the button to match the control area.

     

    Here is the code behind my simple control.#

    It contains a button called Drop, and a list called List, which shows maybe 6 rows of data.

    List is initially visible = false.

    When drop is clicked, the list will appear and disappear. It will appear over any controls placed under the user control, and the area underneath the drop button will not be erased when the list is shown.

     

    Private Sub Drop_Click()
        Showhide
    End Sub


    Private Sub Showhide()
        List.Visible = Not List.Visible
    End Sub

    Private Sub UserControl_Resize()
    drop.Move UserControl.ScaleWidth - drop.Width, 0 'button to the right
    UserControl.Height = List.Height + 60 'keep big enough to show the list
    End Sub

     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only 3 numbers of interest to a computer scientist: 1, 0 and infinity”