Create a PanelManagerPage as a usercontrol.


Author
Message
Keith Gordijn
Keith Gordijn
StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)
Group: Forum Members
Posts: 35, Visits: 2.6K
Hi All,



I have searched the forum on this and did find one topic that did not help me get to where I want to go, provided I can actually get there.



Firstly if this is not a good idea for some reason, performance mainly, please let me know.



I have my main form with an action list on the left and a PanelManager on the right hand side and I want to be able to create PanelManagerPages as "usercontrols" and add them to the PanelManager when they are first called from the main form. From then on the pages remain in the PanelManager and I can just swap between them.



I have created a usercontrol and altered the code to:



using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Text;

using System.Windows.Forms;



namespace FitTrack.UI.WinForms.Controls

{

public partial class UserControl1 : MicroFour.StrataFrame.UI.Windows.Forms.PanelManagerPage

{

public UserControl1()

{

InitializeComponent();

}

}

}





but in the designer I lose the ability to visually create the control and just have the text:



"To add components to your class, drag the from the Toolbox and use the Properties window to set there properties. To create methods and events for your class, click here to switch to code view."



If this is possible, or if it can't be done and there is a way of accomplishing this another way, then any help is appreciated.



Cheers,

Keith Gordijn
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Keith,



I see what you mean about not having a visual design surface. I'm kind of doubting there is a visual designer (at this point) for PanelManagerPage classes. I can think of a couple of work arounds I'd try:



1. Design them in the main form, within the panel manager itself. Once you have them good, copy the code into a subclassed PanelManagerPage type. Of course, maintenance won't be fun...

2. Create actual UserControls for each of the pages (SF User Controls likely would be best). Then when you want to add a panel manager page, you would just create one in code, add the user control to it (forgive any C# faux paus Ermm ):



// Code to add a PanelManagerPage

PanelManagerPage pageOne = new PanelManagerPage();

MyUserControl pageOneControl = new MyUserControl();

pageOne.Controls.Add(pageOneControl);

this.mainPanelManager.PageCollection.Add(pageOne);


3. Similar to above, except create PanelManager page subclasses and add the UserControls there.



Just a couple of thoughts...
Keith Gordijn
Keith Gordijn
StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)StrataFrame Novice (69 reputation)
Group: Forum Members
Posts: 35, Visits: 2.6K
Hi Greg,



Thanks for the reply. I have been busy for the last week and have only just managed to get back and try out your suggestion:





2. Create actual UserControls for each of the pages (SF User Controls likely would be best). Then when you want to add a panel manager page, you would just create one in code, add the user control to it (forgive any C# faux paus Ermm ):



// Code to add a PanelManagerPage

PanelManagerPage pageOne = new PanelManagerPage();

MyUserControl pageOneControl = new MyUserControl();

pageOne.Controls.Add(pageOneControl);

this.mainPanelManager.PageCollection.Add(pageOne);






This works well and there is only a slight overhead when the page is first loaded but this only occurs once from then on everything is as as per normal.



Cheers, Keith
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad that helped!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search