473,508 Members | 2,460 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 10340
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.netwrote in
message news:3d***************@newsfe04.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
SplitterDistance 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.netwrote in message
news:cz***************@newsfe05.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
SplitterDistance 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 SplitterDistance value.

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

"ne***************@charter.net" <ne***************@charter.netwrote in
message news:cz***************@newsfe05.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
SplitterDistance 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 SplitterDistance 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.netwrote in
message news:EN*************@newsfe03.lga:
If I save the SplitterDistance 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
1774
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...
1
2830
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...
1
5333
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...
0
1700
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...
0
1273
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...
2
6211
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...
0
1335
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...
1
2105
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...
5
4729
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 ...
0
7133
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...
0
7405
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...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5643
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,...
1
5059
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...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
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...

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.