Sizechanged event question...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Herfried K. Wagner [MVP]

    #31
    Re: Sizechanged event question...

    Addendum:

    \\\
    Private m_Image As Image
    Private m_Redraw As Boolean = True

    Private Sub Form1_Load( _
    ByVal sender As Object, _
    ByVal e As EventArgs _
    ) Handles MyBase.Load
    m_Image = Image.FromFile( "C:\WINDOWS\Ang ler.bmp")
    End Sub

    Protected Overrides Sub WndProc( _
    ByRef m As Message _
    )
    Const WM_ENTERSIZEMOV E As Int32 = &H231
    Const WM_EXITSIZEMOVE As Int32 = &H232
    Select Case m.Msg
    Case WM_ENTERSIZEMOV E
    m_Redraw = False
    Case WM_EXITSIZEMOVE
    m_Redraw = True
    Me.Panel1.Inval idate()
    End Select
    MyBase.WndProc( m)
    End Sub

    Private Sub Panel1_Paint( _
    ByVal sender As Object, _
    ByVal e As PaintEventArgs _
    ) Handles Panel1.Paint
    If m_Redraw Then
    e.Graphics.Draw Image( _
    m_Image, _
    0, 0, _
    Me.Panel1.Clien tSize.Width, Me.Panel1.Clien tSize.Height _
    )
    End If
    End Sub
    ///

    However, this solution would prevent the panel from redrawing if the window
    is dragged by the mouse.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • Cor Ligthert

      #32
      Re: Sizechanged event question...

      Herfried,

      The main problem is a
      dockable window (thanks to dotnetbar (www.devcomponents.com)).

      The rest of the solutions where already given (I think mine is nicer), do
      you know something about this control and to stop actions using this while
      resizing.

      Cor


      Comment

      • Herfried K. Wagner [MVP]

        #33
        Re: Sizechanged event question...

        "Cor Ligthert" <notmyfirstname @planet.nl> schrieb:[color=blue]
        > \\\
        > Public SwMoving As Boolean
        > Private Sub Panel1_SizeChan ged(ByVal sender As Object, _
        > ByVal e As System.EventArg s) Handles Panel1.SizeChan ged
        > SwMoving = True
        > End Sub
        > Protected Overrides Sub WndProc(ByRef m As Message)
        > If m.Msg = &HA0 Then 'is up[/color]

        '&HA0' is 'WM_NCMOUSEMOVE '! In addition to that, note that the user can
        change the size of a window using the keyboard (Alt+Space -> "Resize" ->
        arrow keys), which won't fire non-client mouse events. All together I don't
        see the benefits of your solution.

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • Cor Ligthert

          #34
          Re: Sizechanged event question...

          Herfried,
          [color=blue]
          > In addition to that, note that the user can change the size of a window
          > using the keyboard (Alt+Space -> "Resize" ->[/color]

          A good addition. However for that can be tested in this procedure probably
          just keyup &H291 with orelse (I did not test it).

          I could not find all those shortcuts from C++ on Google, however I have now
          copied a page from Bob Powell where it is was in, therefore I have them now
          saved in my HKW system.

          I thought yesterday it would be a nice extension if somebody like Herfried
          makes a nice dll so that we can get those in the same way as all other
          enumerations.

          When you need that information from Bob Powell to make this than I can sent
          them you by mail. (Before you say it, yes I can make it myself as well
          however it looks so nice as a link to your page)

          The Herfried.K.Wagn er namespace extension to the framework.

          :-)

          Cor


          Comment

          • Herfried K. Wagner [MVP]

            #35
            Re: Sizechanged event question...

            Cor,

            "Cor Ligthert" <notmyfirstname @planet.nl> schrieb:[color=blue]
            > I thought yesterday it would be a nice extension if somebody like Herfried
            > makes a nice dll so that we can get those in the same way as all other
            > enumerations.[/color]

            Untested:

            A Win32 Library for .NET
            <URL:http://www.codeproject .com/csharp/win32.asp>

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://classicvb.org/petition/>

            Comment

            • Cor Ligthert

              #36
              Re: Sizechanged event question...

              Herfried,

              I will have a look at it, (as you know, do I hate sites which wants my
              emailadres, although I know from you that this one is harmless)

              Thanks,

              Cor


              Comment

              • Herfried K. Wagner [MVP]

                #37
                Re: Sizechanged event question...

                Cor,

                "Cor Ligthert" <notmyfirstname @planet.nl> schrieb:[color=blue]
                > I will have a look at it, (as you know, do I hate sites which wants my
                > emailadres, although I know from you that this one is harmless)[/color]

                Yeah, I hate them too because I have to lookup my password every time I log
                in.

                --
                M S Herfried K. Wagner
                M V P <URL:http://dotnet.mvps.org/>
                V B <URL:http://classicvb.org/petition/>

                Comment

                • johnb41

                  #38
                  Re: Sizechanged event question...

                  Sorry I couldn't try your suggestions out until now. ... and thanks
                  for the continued help with this! Unfortunately the dotnetbar
                  "dockable window" does not have a splitter that has events. No
                  splitter at all that I can see. It's probably using one in the
                  background, but I have no idea how to access it.

                  I think i'm just going to lay this issue to rest. I will not bother
                  having an instantly re-drawable picturebox/panel. Thanks again for all
                  your help!!!

                  John

                  Comment

                  • johnb41

                    #39
                    Re: Sizechanged event question...

                    Herfried,

                    I tried your code, but in my app it produced some side effect errors
                    that I could not figure out. As I wrote to Cor above, I decided to
                    just give up on this effect. But at least this thread was not for
                    nothing... it does have some valuable code for having the SizeChanged
                    event fire once if the "form" itself is resized.

                    Thanks!
                    John

                    Comment

                    Working...