locked
Swapping out controls quickly RRS feed

  • Question

  • First off, this is my first post and I'd like to say hello to everyone, I plan on spending a lot of time here as I'm really getting into Visual C# development and have a few personal projects I've been working on that I will need some "expert" advice on.

    My question is:

    You know how when you are installing something, you have a screen such as a EULA agreement, then with one button click it immediately goes to a new screen such as one prompting you for an Install location. How do you create something that swaps controls out that fast. I tried using Panels, but changing the visible property became a pain. I asked my teacher and he said they use different forms and it's just so fast that you don't notice, but it flickers a little for me, as well as creates a new item in the taskbar.

    I am planning on creating an iPhone app, and before I waste 100 dollars buying a license, I want to make sure I can write the program and I'm laying it out in c#.

    All help is greatly appreciated, Thanks.
    Friday, December 4, 2009 5:58 AM

Answers

  • Hi,

    You can check the completed wizard controls here , here or here . To do that manually, just create a usercontrol that`s hold collection of panels and switch them. Somthing like this:
    class Notebook : UserControl
      {
        private Collection<Panel> Pages = new Collection<Panel>();
    
        private Panel SelectedPage;
    
        [DefaultValue(-1)]
    public int SelectedPageIndex { get { if (SelectedPage != null) { return Pages.IndexOf(SelectedPage); } return -1; } set { SelectPage(value); } } public Notebook() { // allow to drop controls onto this control. SetStyle(ControlStyles.ContainerControl | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); } void SelectPage(int index) { Panel page = Pages[index]; page.Parent = this; page.Dock = DockStyle.Fill; page.BringToFront(); SelectedPage = page;
    }
    }


    -----------------------------------------------------------------------
    Best regards.

    Flexible Treeview - the most flexible treeview-listview-grid hybrid control for .NET!
    • Marked as answer by Jing0 Thursday, December 10, 2009 10:01 AM
    Friday, December 4, 2009 8:23 AM
  • You could create the different screens as user controls and swap them in and out. That is pretty much how I do a wizard type interface. Or you could use a tab control and put each of your screens on a different tab and change tabs accordingly.

    There are also several controls on the market that are created to have a wizard type interface that you could use. http://www.devexpress.com has one I am familiar with. I hope this helps with what you are looking for.
    • Proposed as answer by LandsharkDaddy Friday, December 4, 2009 6:23 AM
    • Marked as answer by Jing0 Thursday, December 10, 2009 10:01 AM
    Friday, December 4, 2009 6:22 AM

All replies

  • You could create the different screens as user controls and swap them in and out. That is pretty much how I do a wizard type interface. Or you could use a tab control and put each of your screens on a different tab and change tabs accordingly.

    There are also several controls on the market that are created to have a wizard type interface that you could use. http://www.devexpress.com has one I am familiar with. I hope this helps with what you are looking for.
    • Proposed as answer by LandsharkDaddy Friday, December 4, 2009 6:23 AM
    • Marked as answer by Jing0 Thursday, December 10, 2009 10:01 AM
    Friday, December 4, 2009 6:22 AM
  • Hi,

    You can check the completed wizard controls here , here or here . To do that manually, just create a usercontrol that`s hold collection of panels and switch them. Somthing like this:
    class Notebook : UserControl
      {
        private Collection<Panel> Pages = new Collection<Panel>();
    
        private Panel SelectedPage;
    
        [DefaultValue(-1)]
    public int SelectedPageIndex { get { if (SelectedPage != null) { return Pages.IndexOf(SelectedPage); } return -1; } set { SelectPage(value); } } public Notebook() { // allow to drop controls onto this control. SetStyle(ControlStyles.ContainerControl | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); } void SelectPage(int index) { Panel page = Pages[index]; page.Parent = this; page.Dock = DockStyle.Fill; page.BringToFront(); SelectedPage = page;
    }
    }


    -----------------------------------------------------------------------
    Best regards.

    Flexible Treeview - the most flexible treeview-listview-grid hybrid control for .NET!
    • Marked as answer by Jing0 Thursday, December 10, 2009 10:01 AM
    Friday, December 4, 2009 8:23 AM