Click here to Skip to main content
Click here to Skip to main content
Go to top

A slide form base

, 18 Dec 2002
Rate this:
Please Sign up or sign in to vote.
A slide form class from which to derive your forms from

Introduction

Sometime ago, I needed a form that had a sliding panel on its side. I’ve checked the web to avoid coding. I’ve found a solution on www.codeguru.com. I’ve used and improved the C++/MFC code. Since, I use C# for my development, you can find here the result of my work. The form class must be inherited and the specialized form must implement a special constructor. You can find below a small example.

Design of a simple slide form

Use the “Add inherited form” wizard in Visual Studio .NET, and select the SlideForm in the inheritance picker dialog.

You’ve got the following form in your project:

Resize and customize it with the appropriate controls. Keep in mind that this form will be hidden by the main form, so, ensure that the child form is smaller than the parent:

Next, you must provide a special constructor for this slide form. This constructor take a reference on the parent form and the step of sliding. This step is a percentage of the slide form that will be showed at each ticks of timer.

public MySlideForm(Form poOwner, float pfStep) : base(poOwner, pfStep) 
{
    InitializeComponent();
} 

We are done with the sliding form. Now, have a look of the way we will make our slide form slide. First, instantiate the slide form:

// In parent form constructor for instance
oSlideForm = new MySlideForm(this, 0.1f); 
// ...

Next, in the handler of the button that command the sliding of the form, use the following code:

// ...
_oSlideForm.SlideDirection = SlideDialog.SlideDialog.SLIDE_DIRECTION.RIGHT; 
_oSlideForm.Slide(); 
// ...

In this example, the form will slide by the right side of the parent form. That's all! Enjoy!

History

  • Initial posting - December 2002

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

nimbus3d
Software Developer (Senior)
France (Metropolitan) France (Metropolitan)
No Biography provided

Comments and Discussions

 
QuestionQuestion PinmemberMember 968818415-Jul-13 21:04 
GeneralMy vote of 5 Pinmemberragavaisr27-Apr-13 22:10 
Questionslide in the opposite direction PinmemberAbdul Rahman El Habboub6-Jan-13 23:26 
QuestionWhen lost focus PinmemberGlimmerMan19-Jun-11 2:06 
GeneralMy vote of 4 PinmemberGlimmerMan19-Jun-11 2:04 
QuestionHow to design the slide form Pinmemberrahul_raut17-May-11 22:32 
GeneralMy vote of 5 Pinmemberrahul_raut17-May-11 22:29 
GeneralSome aesthetic issues PinsussAnonymous15-Feb-05 14:10 
GeneralRe: Some aesthetic issues PinmemberCookie_Jar8-Jul-06 23:32 
GeneralRe: Some aesthetic issues Pinmemberkaymyst10-May-07 5:26 
GeneralOne problem!! PinmemberKaosu17-Jan-04 22:05 
GeneralRe: One problem!! Pinmembersnarfblam28-Dec-06 14:28 
GeneralA SliderWindow does not dock to an MDI child PinsussMamacita7-May-03 0:09 
GeneralMissed Solution File PinmemberJerry Maguire22-Dec-02 0:13 
GeneralRe: Missed Solution File Pinmembernimbus3d25-Dec-02 3:20 
GeneralRe: Missed Solution File PinmemberJerry Maguire25-Dec-02 5:07 
GeneralForm plane level Pinmemberjlwxsf19-Dec-02 13:44 
GeneralRe: Form plane level Pinmembernimbus3d25-Dec-02 3:18 
GeneralRe: Form plane level PinsussStefan Turalski5-Oct-04 1:27 
GeneralRe: Form plane level Pinmemberstefantura5-Oct-04 2:15 
GeneralChanging the rate PinmemberMarc Clifton19-Dec-02 8:27 
GeneralRe: Changing the rate PinmemberMyMojo20-Dec-02 18:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 19 Dec 2002
Article Copyright 2002 by nimbus3d
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid