resize event handler

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Laxmikant Rashinkar

    resize event handler

    Hi,

    I have an event handler that gets called whenever my panel is being resized.
    Since a lot of painting is going on whenever my component is being resized,
    I would like to paint my component only when the last resize event has been
    received; in other words, when the user has released the left mouse button.

    Anyone has any suggestions on how to implement this?

    thanks
    LK


  • Mattias Sjögren

    #2
    Re: resize event handler

    [color=blue]
    >I have an event handler that gets called whenever my panel is being resized.
    >Since a lot of painting is going on whenever my component is being resized,
    >I would like to paint my component only when the last resize event has been
    >received; in other words, when the user has released the left mouse button.
    >
    >Anyone has any suggestions on how to implement this?[/color]

    Why don't you handle the Paint event instead and do your painting
    there?



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org

    Please reply only to the newsgroup.

    Comment

    • Laxmikant Rashinkar

      #3
      Re: resize event handler

      Because even the paint event gets called several times before the user is
      done resizing the component. If it got
      called just once after the resizing was done, that would
      be just what I wanted.

      LK


      "Mattias Sjögren" <mattias.dont.w ant.spam@mvps.o rg> wrote in message
      news:%23FcIlook DHA.2216@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      >[color=green]
      > >I have an event handler that gets called whenever my panel is being[/color][/color]
      resized.[color=blue][color=green]
      > >Since a lot of painting is going on whenever my component is being[/color][/color]
      resized,[color=blue][color=green]
      > >I would like to paint my component only when the last resize event has[/color][/color]
      been[color=blue][color=green]
      > >received; in other words, when the user has released the left mouse[/color][/color]
      button.[color=blue][color=green]
      > >
      > >Anyone has any suggestions on how to implement this?[/color]
      >
      > Why don't you handle the Paint event instead and do your painting
      > there?
      >
      >
      >
      > Mattias
      >
      > --
      > Mattias Sjögren [MVP] mattias @ mvps.org
      > http://www.msjogren.net/dotnet/
      > Please reply only to the newsgroup.[/color]


      Comment

      • Mattias Sjögren

        #4
        Re: resize event handler

        [color=blue]
        >Because even the paint event gets called several times before the user is
        >done resizing the component. If it got
        >called just once after the resizing was done, that would
        >be just what I wanted.[/color]

        Yes, but you might not have to draw everything every time. Check the
        ClipRectangle property of the PaintEventArgs, and only paint the parts
        within that area.



        Mattias

        --
        Mattias Sjögren [MVP] mattias @ mvps.org

        Please reply only to the newsgroup.

        Comment

        Working...