Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2008

Tip: Looking for answers? Try searching our database.

Z-order not working for stacked panels

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ruben L - 23 Jan 2008 02:35 GMT
I'm upgrading/rewriting an apllication written in VB6 to VB2008.
The main form had an outlook-like navigation with a vertical buttonbar in
the left side of the form and a bunch of frames with controls on them in the
main area. All these frames were placed exactly on top of each other, and
pushing a button on the buttonbar made a specific frame come to the fore
(using z-order). it worked nicely for the user - no flickering with forms
being loaded etc.
BUT, in VB6 it was a pain to edit the form (adding new controls etc) since
all the frames belonged to the same form and thus all the frames' controls
were likewise part of the same form making it hard to locate what needed to
be changed, and Z-order wasn't working too good at design time.

In VB2008: On a new form, placed a splitcontainer vertically: OK.
Two new panels placed on top of right panel (same size and different
backcolors) and a few controls (labels) added to each.
Problem: It's not possible to swap those two panels at design time. The
Bring to front/back does not work! Selecting the back panel and chosing Bring
to front does nothing. Selecting the top panel and chosing Send to Back makes
the label from the back panel visible - but NOT the rest of the panel.

If you should build an Outlook look-alike form what road would you take?
(The post below suggest making a form equivalent to a panel and load that
form/embed it, but I'm hesitant about loading and unloading forms due to
heavy datagrids on the forms. Using panels there is only a delay starting up)
http://msdn.microsoft.com/newsgroups/managed/default.aspx?dg=microsoft.public.do
tnet.framework.windowsforms&tid=e11c8b8e-9216-481f-957b-73613f0c85e9&cat=en-us-m
sdnman-dotnet-frmwrk&lang=en&cr=US&sloc=en-us&m=1&p=1


Any ideas or best practices?

Thanks
/Ruben

Signature

Ruben Lysemose, Systems Consultant

Michael C - 23 Jan 2008 03:26 GMT
> In VB2008: On a new form, placed a splitcontainer vertically: OK.
> Two new panels placed on top of right panel (same size and different
[quoted text clipped - 5 lines]
> makes
> the label from the back panel visible - but NOT the rest of the panel.

Sounds like all the controls are not children of the panel.

> If you should build an Outlook look-alike form what road would you take?

Usercontrols. You should have done it this way in VB6 as well. I did
something similar in vb6 recently and it worked really well. It'd work even
better in dot net. :-)

Michael
Ruben L - 23 Jan 2008 04:31 GMT
Michael, what would the benefit be of developing several user controls (to be
used in this project only) compared to the develop-several-forms approach? It
seems much easier to design forms - and I guess user controls will still need
to load data just as separate forms(?)
Signature

Ruben Lysemose, Systems Consultant

> > In VB2008: On a new form, placed a splitcontainer vertically: OK.
> > Two new panels placed on top of right panel (same size and different
[quoted text clipped - 15 lines]
>
> Michael
Michael C - 23 Jan 2008 05:02 GMT
> Michael, what would the benefit be of developing several user controls (to
> be
> used in this project only) compared to the develop-several-forms approach?

You can't host a form inside another form (at least not without hacks).

> It
> seems much easier to design forms

It's pretty much the same really, you just drag and drop controls, move them
around etc.

> - and I guess user controls will still need
> to load data just as separate forms(?)

Not necessarily, you could a class that holds the required data and pass an
instance of that class to each control. Generally you'd create an interface
for each of the controls to implement.

Michael
Ruben L - 24 Jan 2008 00:53 GMT
Thanks Michael. It looks like that's the right track!

For other newbies: Project - Add User Control - let the user Control
template remain selected and change name - Add - and you have a new Form
Designer Window. Do your stuff as you would with a form and then Build the
project.
The user control will now be available in your toolbox in a "MyProjects
Components" section - visible when in form design.
For the Outlook-a like - situation mentioned above: add the user controls on
top of each other and use BringToFront/back. Works so far :-)
Signature

Ruben Lysemose, Systems Consultant

> > Michael, what would the benefit be of developing several user controls (to
> > be
[quoted text clipped - 16 lines]
>
> Michael
Michael C - 24 Jan 2008 23:43 GMT
> Thanks Michael. It looks like that's the right track!
>
[quoted text clipped - 7 lines]
> on
> top of each other and use BringToFront/back. Works so far :-)

One other thing worth considering is adding an interface to each of these
controls. For example, if every control needs to have a method called
PopulateData then you would define an interface like this

public interface IWhatever
{
     void PopulateData();
}

then in your usercontrols add this

public MyUsercontrol : UserControl, IWhatever

then right click IWhatever and select Implement.

This way all your controls can be treated as an IWhatever and you can define
an IWhatever array to store them in.

Michael

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.