AutoSize Issues

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Cool

    #1

    AutoSize Issues

    I am trying to display several images on a standard Windows Form. Each
    image is displayed in a PictureBox control that is 180,130 in size. I
    get the Primary Screen size to determine how many images will on one
    line of images. I have a form boolean variable that I set to true in
    the ClientSizedChan ged event handler. In the loop where I am
    displaying the images, I check this boolean, and if true, I set the Y
    coordinate loop counter to the actual Y location of the last image
    placed.

    This seems to work OK for the first line of images drawn after the
    first client size changed event, but it goes haywirea after that,
    drawing each image at some random location on a line, with several
    lines since the last image drawn.

    It seems unpredictable on just how the client size is adjusted on an
    autoscroll generated event.

    Any help would be appreciated.
  • Peter Duniho

    #2
    Re: AutoSize Issues

    On Thu, 01 May 2008 19:33:00 -0700, Joe Cool <joecool@home.n etwrote:
    I am trying to display several images on a standard Windows Form. Each
    image is displayed in a PictureBox control that is 180,130 in size. I
    get the Primary Screen size to determine how many images will on one
    line of images. I have a form boolean variable that I set to true in
    the ClientSizedChan ged event handler. In the loop where I am
    displaying the images, I check this boolean, and if true, I set the Y
    coordinate loop counter to the actual Y location of the last image
    placed.
    >
    This seems to work OK for the first line of images drawn after the
    first client size changed event, but it goes haywirea after that,
    drawing each image at some random location on a line, with several
    lines since the last image drawn.
    >
    It seems unpredictable on just how the client size is adjusted on an
    autoscroll generated event.
    The client size shouldn't be changing if all you're doing is scrolling.
    As for the rest of your post, I admit it's not really all that clear to me
    what you've implemented, or that your approach is actually appropriate for
    the goal. However, assuming that what you're trying to do is fill a form
    with PictureBox instances, you may want to look at the FlowLayoutPanel
    control. You can add arbitrarily many child controls to it, and it will
    automatically handle laying them out to fit as necessary.

    Pete

    Comment

    • Cor Ligthert[MVP]

      #3
      Re: AutoSize Issues

      Joe,

      Have a look at the Anchor and Dock properties.

      Trying to do it by hand will fail almost forever.
      That was going when all screens had a standard rectangle.

      Cor

      "Joe Cool" <joecool@home.n etschreef in bericht
      news:aruk145us3 l5r83kpf7gc1lrq 2qe1s56bf@4ax.c om...
      >I am trying to display several images on a standard Windows Form. Each
      image is displayed in a PictureBox control that is 180,130 in size. I
      get the Primary Screen size to determine how many images will on one
      line of images. I have a form boolean variable that I set to true in
      the ClientSizedChan ged event handler. In the loop where I am
      displaying the images, I check this boolean, and if true, I set the Y
      coordinate loop counter to the actual Y location of the last image
      placed.
      >
      This seems to work OK for the first line of images drawn after the
      first client size changed event, but it goes haywirea after that,
      drawing each image at some random location on a line, with several
      lines since the last image drawn.
      >
      It seems unpredictable on just how the client size is adjusted on an
      autoscroll generated event.
      >
      Any help would be appreciated.

      Comment

      Working...