Controls at run time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Luis Mendes

    #1

    Controls at run time

    If I create several controls (images) at run time, how can I handle the click
    event of this controls.

    Thanks in advance,

    Luis Mendes
  • elziko

    #2
    Re: Controls at run time

    > If I create several controls (images) at run time, how can I handle the[color=blue]
    > click
    > event of this controls.[/color]

    Use the AddHandler statement:

    AddHandler TheObject.TheEv ent, AddressOf TheProcedureToH andleEvent

    HTH


    Comment

    • Luis Mendes

      #3
      Re: Controls at run time

      Thanks for your sugestion.

      I can deal with that if I know the number of images to create.

      Let me explain better:

      I wanto to scan a folder and present the images of that folder in panel (I
      just know the number of images at run time).
      When the user click's one of this images I need to know with was selected
      in order to open a new form with this image.

      Thanks in advance

      Luis

      "elziko" wrote:
      [color=blue][color=green]
      > > If I create several controls (images) at run time, how can I handle the
      > > click
      > > event of this controls.[/color]
      >
      > Use the AddHandler statement:
      >
      > AddHandler TheObject.TheEv ent, AddressOf TheProcedureToH andleEvent
      >
      > HTH
      >
      >
      >[/color]

      Comment

      • elziko

        #4
        Re: Controls at run time

        > I wanto to scan a folder and present the images of that folder in panel (I[color=blue]
        > just know the number of images at run time).
        > When the user click's one of this images I need to know with was selected
        > in order to open a new form with this image.[/color]

        It sounds like you want to show thumbnails of images and then allow the user
        to click on a thumbnail to see a large image. Is that correct?

        If it is then consider using a ListView.

        At run time add your images to an ImageList and use that ImageList for the
        LargeImageList property of the ListView. The you can add items to the
        ListView during runtime setting each item's image index to be one of the
        indexes in the image list.

        Then you can use the SelectedIndexCh anged event to see when a user has
        clicked on a thumbnail.

        HTH


        Comment

        • Luis Mendes

          #5
          Re: Controls at run time

          Thanks.

          "elziko" wrote:
          [color=blue][color=green]
          > > I wanto to scan a folder and present the images of that folder in panel (I
          > > just know the number of images at run time).
          > > When the user click's one of this images I need to know with was selected
          > > in order to open a new form with this image.[/color]
          >
          > It sounds like you want to show thumbnails of images and then allow the user
          > to click on a thumbnail to see a large image. Is that correct?
          >
          > If it is then consider using a ListView.
          >
          > At run time add your images to an ImageList and use that ImageList for the
          > LargeImageList property of the ListView. The you can add items to the
          > ListView during runtime setting each item's image index to be one of the
          > indexes in the image list.
          >
          > Then you can use the SelectedIndexCh anged event to see when a user has
          > clicked on a thumbnail.
          >
          > HTH
          >
          >
          >[/color]

          Comment

          Working...