473,806 Members | 2,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save the state of a SplitContainer


I want to save the state of a splitcontainer when an application ends. I
also save the form state. The SplitContainer does not seem to have a well
defined place to put intiialization and termination code.

I have tried to use my first splitter moved event to set the splitter
position but I am getting several splitter moved events before my form is
displayed. One is from the form initialization code and the second is from
my code that restore the form to it's original position and size.

Does anybody have a good method to know when to do the initialization.

Thanks
Tom Groszko
Mar 14 '07 #1
7 10406
The simplest way would be to bind the splitcontainer properties to
application settings and the bindingmanager will save the settings
automatically.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com

"ne************ ***@charter.net " <ne************ ***@charter.net wrote in
message news:3d******** *******@newsfe0 4.lga:
I want to save the state of a splitcontainer when an application ends. I
also save the form state. The SplitContainer does not seem to have a well
defined place to put intiialization and termination code.

I have tried to use my first splitter moved event to set the splitter
position but I am getting several splitter moved events before my form is
displayed. One is from the form initialization code and the second is from
my code that restore the form to it's original position and size.

Does anybody have a good method to know when to do the initialization.

Thanks
Tom Groszko
Mar 14 '07 #2
Save and retrieving the data is not a problem. I have a well tested way to
keep them in a database. Applications settings don't work because Microsoft
is constantly changing the behaviour. It sometimes even can change when you
use one click install versus an old fasioned install so I don't use
Micorsoft mechanisms for this kind of data.

The real problem is that I cannot find an appropriate time to set the
SplitterDistanc e property. I cannot find an event that is called after all
else is done and before the splitter is first drawn.

Thanks for your response.
Tom Groszko
Mar 14 '07 #3
VJ
so once drawn you don't give the user a ability to move splitter, or maybe I
got that wrong...
If they are moving, the best place would be at your Application windows
close event...persist the state then...

VJ
<ne************ ***@charter.net wrote in message
news:cz******** *******@newsfe0 5.lga...
Save and retrieving the data is not a problem. I have a well tested way to
keep them in a database. Applications settings don't work because
Microsoft
is constantly changing the behaviour. It sometimes even can change when
you
use one click install versus an old fasioned install so I don't use
Micorsoft mechanisms for this kind of data.

The real problem is that I cannot find an appropriate time to set the
SplitterDistanc e property. I cannot find an event that is called after all
else is done and before the splitter is first drawn.

Thanks for your response.
Tom Groszko

Mar 14 '07 #4
Since there is no suitable event on the control itself, it may be best
to put the initialization code in the Form's Load event instead. If
this control is a subclass of the SplitContainer control, you could use
the ParentChanged event to set the SplitterDistanc e value.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com

"ne************ ***@charter.net " <ne************ ***@charter.net wrote in
message news:cz******** *******@newsfe0 5.lga:
Save and retrieving the data is not a problem. I have a well tested way to
keep them in a database. Applications settings don't work because Microsoft
is constantly changing the behaviour. It sometimes even can change when you
use one click install versus an old fasioned install so I don't use
Micorsoft mechanisms for this kind of data.

The real problem is that I cannot find an appropriate time to set the
SplitterDistanc e property. I cannot find an event that is called after all
else is done and before the splitter is first drawn.

Thanks for your response.
Tom Groszko
Mar 15 '07 #5
The client can move it anytime they want. Moving is trivial to capture and
save. I am builing a subclass of splitcontainer. ParentChanged has not
worked because a control way down the chain does not know when it is finally
hooked up to a form and that form has run it's code to set the window to
it's previous state. I have attempted various things with ParentChanged and
FindForm but nothing seems to work well for control not directly on the
form. I also have a form subclass that when it does it's set to the previous
state looks at all it's child controls and the child's children etc for a
control that is my splitcontainer and asks the container to to the initial
set but is seem that controls on tab pages way down the chain have not been
built yet.

Thanks again for your thoughts.

Tom Groszko
Mar 16 '07 #6
If I save the SplitterDistanc e as a percent of the whole control I no longer
have to be concern with the window not being the same size as when I save
the value. If I look during the resize, splittermoved and resumelayout
routines and insure that the control name is filled in I am close to what I
want.

A remaining problem is I need to uniquely name each of these for an
application. I am not sure how to make the name unique for these when they
are embedded in other user controls that can be used in several places
within the application.

Thanks again
Tom Groszko
Mar 16 '07 #7
You could use Reflector (www.aisto.com/roeder) to look at how ASP.Net
generates unique names and emulate that approach.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com

"ne************ ***@charter.net " <ne************ ***@charter.net wrote in
message news:EN******** *****@newsfe03. lga:
If I save the SplitterDistanc e as a percent of the whole control I no longer
have to be concern with the window not being the same size as when I save
the value. If I look during the resize, splittermoved and resumelayout
routines and insure that the control name is filled in I am close to what I
want.

A remaining problem is I need to uniquely name each of these for an
application. I am not sure how to make the name unique for these when they
are embedded in other user controls that can be used in several places
within the application.

Thanks again
Tom Groszko
Mar 17 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1786
by: Brian A. Cline | last post by:
I have a SplitContainer that holds a TreeView and ListView. When using the splitter to resize them, a focus rectangle is shown during and after the resize event. Is there any way to prevent this? I have already tried setting the SplitContainer's TabStop property to false but it had no effect on the aforementioned behavior. Thanks, Brian Cline
1
2846
by: Martin | last post by:
Hi all! I made a UserControl with a SplitContainer in it. I put some controls in the SplitContainer.Panel1. After that, I created a new UserControl which inherit from the previously created UserControl. So far, so good... I can see the SplitContainer in the new UserControl. However, I have a problem. I can't add a control in the Panel2 of the SplitContainer of the UserControl which inherit from the UserControl with the SplitContainer...
1
5398
by: Ronald S. Cook | last post by:
At design time, how can I change the name of the SplitterPanels that are children within my SplitContainer control? I was able to name the SplitContainer splContainer, but I can't see how to change the name of the panels. They are splContainer.Panel1 and splContainer.Panel2... very annoying. Thanks for any help, Ron
0
1718
by: =?Utf-8?B?TmVpbGc=?= | last post by:
I have a SplitContainer in which I have TextBox filled on one side and a RichTextBox on the other. I just noticed when I do a text select in either textbox, the controls don't respond to Control C for a copy. Has anyone seen this behavior when using a Splitcontainer and textboxes? I have been captured the keydown event for the textboxes but
0
1303
by: Ronald S. Cook | last post by:
Thanks in advance for reading/responding. In my Windows forms app, I was going to have an Infragistics ListBar control docking/filling the left panel of a SplitContainer, and use the right panel to load my user controls. But now I want to sometimes have another user control (narrow.. to show a list) next to (on the right of) my ListBar. I'll want the right panel to spring/maximize to as much space as it can take up. If there is just...
2
6231
by: Doc John | last post by:
We developed a Win application that basically consists of an Mdi Form and several child Forms. Now we want to change its appearance so that it has an Outlook-like appearance: it would have a panel on the left with several buttons, and when I press those buttons the individual Forms would open up on the right panel. How difficult would this transition be? I've added a splitContainer to my Mdi Form, but I'm not sure how to display a Child...
0
1349
by: KalupaPaluku | last post by:
Hello!!! I've got a problem of my form application that the KeyDown function doesn't work. It suppose to be go to the next textbox field within same panel control but it doesn't work, as i'm using SplitContainer.Panel in such forms. Isn't it the SplitContainer caused this problem happen? How can i solve the problem? The code that i'm use is VB 2005. Private Sub TextBox64_KeyDown(ByVal sender As Object, ByVal e As...
1
2129
by: Zoliq | last post by:
Hi, I have the following problem: have a splitcontainer with horizontal orientation. The application saves the current settings of the user interface including the splitter distance when the form is closed. When the form is load up the settings should be restored. The problem I have is that everytime the form is loaded the splitter is not positioned correctly. Everytime a value is added to the original value of saved one. I figured it out...
5
4747
by: kulabhishek | last post by:
Hello, I have developed one user control using SplitContainer. It is simply like two textboxes connected to each other with splitter in between them. Whenever I increase width of the control 1. By dragging it with right edge, I want the splitter and the left textbox to remain fixed and 2. By dragging it with left edge, I want the splitter and the right textbox to remain fixed. We can set only one of the panels as FixedPanel.
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10623
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.