making a piece slide out of a form

fguihen

Junior Contributor
Joined
Nov 10, 2003
Messages
248
Location
Eire
i want to be able to click a button on a form, which will make a piece slide out of or appear at the side of the form, which i can close again without closing the form. the piece that slides out/appears is to contain more controls. is this possible?
 
Quite possible.
Visual Basic:
    'Constants to specify animation type and direction
    Enum AnimationConstants As Integer
        AW_HOR_POSITIVE = 1
        AW_HOR_NEGATIVE = 2
        AW_VER_POSITIVE = 4
        AW_VER_NEGATIVE = 8
        AW_CENTER = 16
        AW_HIDE = 65536
        AW_ACTIVATE = 131072
        AW_SLIDE = 262144
        AW_BLEND = 524288
    End Enum
 
    'Import from Windows API
    <System.Runtime.InteropServices.DllImport("user32.dll")> _
    Shared Function AnimateWindow( _
        ByVal hWnd As IntPtr, _
        ByVal millseconds As Integer, _
        ByVal lFlags As AnimationConstants) As Boolean
    End Function
 
    Sub Example()
        AnimateWindow(Me.Handle, 300, AnimationConstants.AW_VER_NEGATIVE)
    End Sub
C#:
	enum AnimationConstants{
		AW_HOR_POSITIVE = 1,
		AW_HOR_NEGATIVE = 2, 
		AW_VER_POSITIVE = 4 ,
		AW_VER_NEGATIVE = 8,
		AW_CENTER = 16,
		AW_HIDE = 65536,
		AW_ACTIVATE = 131072,
		AW_SLIDE = 262144,
		AW_BLEND = 524288
	}

	[System.Runtime.InteropServices.DllImport("user32.dll")]
	bool AnimateWindow(IntPtr hWnd, int millseconds, AnimationConstants Flags );
	
		void Example(){
			AnimateWindow(this.Handle, 300, AnimationConstants.AW_VER_NEGATIVE);
		}
 
thank you, however your answer is a bit more complex than i require. i want to know how do i make a form appear at the side of an existing form, to show controls that are hidden when this piece of form is not visible. animation is not important, just as long as i can make the piece of the form appear and disappear on request is more important
 
Then you might want to consider simply adding a panel and setting its visible property to true/false to show/hide it.
 
Back
Top